#include<stdio.h> #include<stdio.h> #include<ctype.h> #include<math.h> int main() { int a,q,i=0,j,ans=0; int arr[10]; char c; clrscr(); printf("\n Enter any character :"); scanf("%c",&c); a=toascii(c); q=a; printf("\n\n%d",q); while(q!=1) { arr[i]=q%2; q/=2; i++; } arr[i]=1; printf("\nAscii To Binary..\n"); for(j=i;j>=0;j--) printf("%d",arr[j]); for(j=i;j>=0;j--) { if(arr[j]==1) ans+=pow(2,j); } printf("\n Binary to Ascii..%d & Char .. %c\n",ans,ans); return 0; }
0 comments:
Post a Comment