Skip to content
Home » Octal to decimal C program

Octal to decimal C program

Learn about Octal to decimal C program in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.


Octal to decimal C program


 int main()
     int oct, dec=0, rem, i=0;

     printf("Enter a Octal Number: ");

         rem = oct%10;
         dec += (rem * pow(8,i));
         oct /= 10;

     printf("Decimal Value = %d",dec);

     return 0;


Enter a Octal Number: 48
Decimal Value = 40

Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.

Similar Codes :
Decimal to Octal conversion in C using Function
C program to convert decimal to octal using while loop