Over a million developers have joined DZone.

Binary To Decimal In C

·
program to convert binary number to decimal 


#include 
#include 
main()
{
	int bin,rem,n=0,sum=0;
	printf("please enter binary number");
	scanf("%d",&bin);
	while(bin)
	{
		rem=bin%10;
		sum=sum+(rem*pow(2,n));
		bin=bin/10;
		n++;
	}
	printf("%d\n",sum);	
}
/*
by joseph dias 
email josephdias92@gmail.com
*/

Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}