Contact Learn C
Copy Program Share Program

Program 99:Program to Convert Octal to Decimal

Program 99:
 
#include<stdio.h>
#include<math.h>
main()
{
int dec=0,temp,i,inc=0,octal;
printf("Enter octal numer to convert to deciml number\n");
scanf("%d",&octal);
temp=octal;
while(temp!=0)
{
    i=temp%10;
    dec=dec+(i*pow(8,inc));
    temp=temp/10;
    inc++;
}
printf("Decimal number of %d is %d\n",octal,dec);
}
Explanation:

This Programs' Explanation is same as Program 28 :Convert Binary to Decimal

 Output:

Convert Octal to Decimal

Download App and Learn when ever you want

Get it on PlayStore
Get it on Amazon App Store
Get it on Aptoide