diff --git a/Python/program-19/program.py b/Python/program-19/program.py new file mode 100644 index 00000000..80444473 --- /dev/null +++ b/Python/program-19/program.py @@ -0,0 +1,14 @@ +#Python Program to Convert Decimal to Binary + +def decimalToBinary(num): + """This function converts decimal number + to binary and prints it""" + if num > 1: + decimalToBinary(num // 2) + print(num % 2, end='') + + +# decimal number +number = int(input("Enter any decimal number: ")) + +decimalToBinary(number) diff --git a/Python/program-19/readme.md b/Python/program-19/readme.md new file mode 100644 index 00000000..28cc94e5 --- /dev/null +++ b/Python/program-19/readme.md @@ -0,0 +1 @@ +Program to convert Binary to Decimal