Convert Octal to Decimal number in C, C++, Java and python | FACE Prep
Published on 10 Mar 2020
Program to convert a number from octal to decimal is discussed here. Given an octal number, convert the given octal number into its equivalent decimal number.
For example, octal number 1907 has to be converted to decimal.
7 * 8^0 = 7
0 * 8^1 = 0
9 * 8^2 = 576
1 * 8^3 = 512
512 + 576 + 0 + 7 = 1095
The decimal equivalent of octal number 1907 is 1095.
Algorithm to convert a number from octal to decimal
- Input the octal number.
- Find the number of digits in the number.
- Let it have n digits.
- Multiply each digit in the number with 8n-1, when the digit is in the nth position.
- Add all digits after multiplication.
Program to convert a number from octal to decimal
Enter an octal number: 350
Decimal Equivalent :232
If you have any feedback about this
article and want to improve this, please write to firstname.lastname@example.org