Python Program to Convert Decimal to Binary
In this program we are going to learn how to convert decimal number (base 10) to binary number (base 2). In this program we use bin method for converting decimal to binary number (0 or 1).
Input:
2
Output:
10
Explanation:
2(base 10) = 10 (base 2)
generally it was done by dividing 2 with given decimal value and take remainders from bottom to up.
Code:
r=int(input())
print(bin(r)[2:])
Note:
Hello Guys, Don't Stop Learning keep Going..............