#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int n,a,sum=0,i=0;
clrscr();
printf("enter binary number");
scanf("%d",&n);
while(n>0)
{
a=n%10;
sum=sum*a*pow(2,i);
n=n/10;
i++;
}
printf("dc=%d",sum);
getch();
}
#include<conio.h>
#include<math.h>
void main()
{
int n,a,sum=0,i=0;
clrscr();
printf("enter binary number");
scanf("%d",&n);
while(n>0)
{
a=n%10;
sum=sum*a*pow(2,i);
n=n/10;
i++;
}
printf("dc=%d",sum);
getch();
}
0 Comments