#include<stdio.h>
#include<math.h>

int main()
{
long int i,n,x=0,a;
printf("Enter any binary number: ");
scanf("%ld",&n);
printf("\nThe decimal conversion of %ld is ",n);

for(i=0;n!=0;++i)
{
a=n%10;
x=(a)*(pow(2,i))+x;
n=n/10;
}

printf("%ld",x);

return 0;
}

OUTPUT :

Enter any binary number : 1010

The decimal conversion of 1010 is 10


For Other Programs Visit The WebSite:-   https://www.techapurba.com/

Follow Me On Social Media :-


For tech related videos visit my other website :- https://apurbatechinfo.blogspot.com/