//Program to convert binary number to decimal number.
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
long int num;
int r,n,i=0,k=-1;
clrscr();
printf("program to convert binary to decimal");
printf("\n Enter the number: ");
scanf("%ld",&num);
while(num>0)
{
k=k+1;
r=num%10;
num=num/10;
i=i+r*pow(2,k);
}
printf("The decimal equivalent is=%d ",i);
getch();
}
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
long int num;
int r,n,i=0,k=-1;
clrscr();
printf("program to convert binary to decimal");
printf("\n Enter the number: ");
scanf("%ld",&num);
while(num>0)
{
k=k+1;
r=num%10;
num=num/10;
i=i+r*pow(2,k);
}
printf("The decimal equivalent is=%d ",i);
getch();
}