// convert the given binary number into decimal number
#include<stdio.h>
#include<math.h>
int main(void)
{
int decinum=0,binum,i=0,rem;;
printf("Enter the number in binary : ");
scanf("%d",&binum);
int temp=binum;
while(binum!=0)
{
rem = binum%10;
decinum += pow(2,i)*rem;
binum=binum/10;
i++;
}
printf("\nDecimal form of %d is %d \n",temp,decinum);
}
output:
Hi. I’m Designer of Blog Magic. I’m CEO/Founder of ThemeXpose. I’m Creative Art Director, Web Designer, UI/UX Designer, Interaction Designer, Industrial Designer, Web Developer, Business Enthusiast, StartUp Enthusiast, Speaker, Writer and Photographer. Inspired to make things looks better.
Good one.
ReplyDeleteVery informative.
Thank you