C Program convert octal to decimal Number
In this example,we will discuss how to convert octal to decimal number system in the c programming language. Following is the solution to the problem.
Code:
#include <stdio.h>
#include <math.h>
using namespace std;
int main()
{
int octalNumber,originalnumber;
printf("Enter a octal number: ");
scanf("%d", &octalNumber);
originalnumber=octalNumber;
int decimalNumber = 0, i = 0, remainder;
while (octalNumber != 0)
{
decimalNumber += (octalNumber%10) * pow(8,i);
++i;
octalNumber/=10;
}
printf("%d in octal = %d in decimal", originalnumber, decimalNumber);
return 0;
}
Output:
Enter a octal number: 74
74 in octal = 60 in decimal
Good Information
ReplyDeletehttps://conceptsall.com/how-to-install-windows-10-from-usb/