diff --git a/algorithms/math/decimal_to_binary.py b/algorithms/math/decimal_to_binary.py new file mode 100644 index 0000000..9739363 --- /dev/null +++ b/algorithms/math/decimal_to_binary.py @@ -0,0 +1,12 @@ +"""converting decimal to binary. + +@author Midhun Nair +""" + +def decimal_to_bonary(number:int): + if number >= 1: + decimal_to_bonary(number // 2) + print(number % 2, end = "") + +if __name__ == "__main__": + decimal_to_bonary(5) \ No newline at end of file