#include<stdio.h>
#include<math.h>
int main()
{
int i = 0, anik, n, sum = 0;
printf("Enter any number : ");
scanf("%d", &n);
while(n != 0)
{
anik = n%10;
n = n/10;
sum = sum + (anik * pow(2,i));
i++;
}
printf("Decimal Number : %d", sum);
return 0;
}
#include<math.h>
int main()
{
int i = 0, anik, n, sum = 0;
printf("Enter any number : ");
scanf("%d", &n);
while(n != 0)
{
anik = n%10;
n = n/10;
sum = sum + (anik * pow(2,i));
i++;
}
printf("Decimal Number : %d", sum);
return 0;
}
Comments
Post a Comment