Headlines
Loading...
C Program to convert binary no in to decimal no

C Program to convert binary no in to decimal no

C Program to convert binary number to decimal number

#include<stdio .h="">
#include<conio .h="">
#include<math .h="">
void main() 
{
int no,rem,d,n=0,sum=0;
clrscr();
printf("\nEnter the binary no:");
scanf("%d",&amp;no);
while(no!=0)
{
rem=no%10;
d=rem*pow(2,n);
n++;
no=no/10;
sum=sum+d;

}
printf("\nThe decimal no is:%d",sum);
getch();
}


************OUTPUT**************

Enter the binary no:1111

The decimal no is:15</math></conio></stdio>
*** PLEASE checkout the Best deals from for top sites like Amazon, Flipkart etc ***