Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Binary To Decimal In C

DZone's Guide to

Binary To Decimal In C

·
Free Resource
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:

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}