Decimal to octal conversion in one line by R4R Team

Octal number-

- A number which expressed in the base-8 numeral system.
- Octal number range is 0 to 7

Decimal number -

- A number which expressed in the base-10 numeral system.
- Decimal number range is 0 to 9

Conversion of Decimal to octal number
Example-
Decimal number - 10
Its octal equivalent is 1010

Decimal number - 11
Its octal equivalent is 1011

program -

print("Octal equivalent is - "+oct(int(input("Enter Decimal numbern"))))


output -

Enter Decimal number
10
Octal equivalent is - 0o12


Enter Decimal number
45
Octal equivalent is - 0o55


-In this program, we use oct() function which is build-in function in python, which find the octal value for the given decimal number and in the output 0o denotes that the this is octal number.

Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!