Covert Base 7 to Decimal number in C program
#include
#include
int main()
{
printf ("Covert Base7 to Decimal\n");
int num, Decimal=0, base=1;
printf ("Please input your Base7 :");
scanf("%d",&num);
int temp=num;
while (temp){
int rem= temp % 10;
temp = temp/10;
Decimal += rem*base;
base = base*7;
}
printf("The result of Decimal is:%d", Decimal);
return 0;
}
Result output:
0 Comments