Octal to Decimal
#include
#include
int main()
{
printf("\nCovert Octal number to Decimal number");
int num;
printf("\nInput Octal number:");
scanf("%d",&num);
int dec_value = 0;
int base = 1;
int temp = num;
while (temp){
int last_digit = temp % 10;
temp = temp /10;
dec_value += last_digit *base;
base = base * 8;
}
printf("\nThe result of Decimal is %d\n",dec_value);
return 0;
}
Output
0 Comments