codescracker


python

Python Program to Convert Octal to Decimal



« Previous Program Next Program »


Convert Octal to Decimal in Python

To convert octal to decimal number in python, you have to ask from user to enter a number in octal number system to convert it into decimal number to display the equivalent number in decimal format as shown in the program given below.

Python Programming Code to Convert Octal to Decimal

Following python program ask from user to enter any number in octal number system to convert it into decimal number:

# Python Program - Convert Octal to Decimal
		
while True:
	print("Enter 'x' for exit.")
	octal = input("Enter number in Octal Format: ")
	if octal == 'x':
		break
	else:
		decimal = str(int(octal, 8))
		print(octal,"in Decimal =",decimal,"\n")

Here is the sample run of the above Python program demonstrating how to convert octal number to decimal number:

python convert octal to decimal

Same Program in Other Languages

You may also like to learn or practice the same program in other popular programming languages:


« Previous Program Next Program »




Tools
Calculator

Quick Links
Signup - Login - Give Online Test