C program to convert Octal to Decimal.

#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
    int octnum, decnum=0, i=0, rem;
    printf("Enter any Octal Number: ");
    scanf("%d", &octnum);
    while(octnum!=0)
    {
        rem = octnum%10;
        decnum = decnum + (rem*pow(8,i));
        i++;
        octnum = octnum/10;
    }
    printf("\nEquivalent Decimal Value = %d", decnum);
    getch();
    return 0;
}
C program to convert Octal to Decimal. C program to convert Octal to Decimal. Reviewed by on December 22, 2019 Rating: 5

No comments:

Powered by Blogger.