#include<stdio.h> #include<math.h> int main() { int a,b,c=0,f=0; printf("Enter the binary number\n"); scanf("%d",&a); printf("Decimal of %d is\n",a); while(a!=0) { b=a%10; a=a/10; f=f+pow(2,c)*b; c++; } printf("%d",f); } OUTPUT Enter the binary number 1011 Decimal of 1011 is 11
The basic is nice sir . You are starting from base Isa good move.
ReplyDelete