#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
Follow
Me On Social Media :-
INSTA photography page :- https://www.instagram.com/photo_mania_hub/
Twitter link : - https://twitter.com/ApurbaKhanra199
Facebook page link (Crazy Coders) :-https://www.facebook.com/codercrazy/?modal=admin_todo_tour
Insta photography link :- https://www.instagram.com/photo_mania_hub/
Facebook link :- https://www.facebook.com/profile.php?id=100009747586288
FB photography page :-
https://www.facebook.com/photomaniahub/?modal=admin_todo_tour
For tech related videos visit my other website :- https://apurbatechinfo.blogspot.com/
0 Comments