C Programme to convert Binary to Decimal
#include<conio.h> #include<stdio.h> #include<math.h> int main() { int num,i=0,j,a,r=0; printf("\nEnter binary number"); scanf("%d",&num); while(num!=0) { a=num%10; num=num/10; r=r+a*pow(2,i); i++; } printf("\nDecimal number is:%d",r); }
0 comments:
Post a Comment