#include<stdio.h>
#include<conio.h>
int main()
{
clrscr();
long int bn,dn=0,j=1,rm;
printf("Enter any number any binary number: ");
scanf("%ld",&bn);
while(bn!=0){
rm=bn%10;
dn=dn+rm*j;
j=j*2;
bn=bn/10;
}
printf("Equivalent decimal value: %ld",dn);
getch();
return 0;
}
#include<conio.h>
int main()
{
clrscr();
long int bn,dn=0,j=1,rm;
printf("Enter any number any binary number: ");
scanf("%ld",&bn);
while(bn!=0){
rm=bn%10;
dn=dn+rm*j;
j=j*2;
bn=bn/10;
}
printf("Equivalent decimal value: %ld",dn);
getch();
return 0;
}
No comments:
Post a Comment