Decimal to binary conversion in one line by R4R Team

Binary number

-It is a number which expressed in the base-2 numeral system,
-Binary numbers are 0 or 1.

Decimal number

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

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

Decimal number - 11
Its binary equivalent is 1011

Program -

print(bin(int(input("Enter Decimal numbern"))))


Output -

Enter Decimal number
10
0b1010

Enter Decimal number
32
0b100000


-In this program, we take input of decimal number and using 'bin()' function we directly find the binary equivalent of the given decimal number and in the output 0b denotes that the number is binary.

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!