Programmers blog
Programs
Friday, 22 March 2013
C program to convert binary to decimal number
#include
#include
main()
{
int bin=0,i=1,dec=0;
printf("enter bin num");
scanf("%d",&bin);
while(bin!=0)
{
dec=dec+(bin%10)*i;
i=i*2;
bin=bin/10;
}
printf("dec=%d",dec);
getch();
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment