49.0k views
18 votes
Write a python program to convert a number entered by the user

the input is 985
the output is Nine Eight Five

1 Answer

5 votes

Answer:

# Function to convert decimal number

# to binary using recursion

def DecimalToBinary(num):

if num >= 1:

DecimalToBinary(num // 2)

print(num % 2, end = '')

# Driver Code

if __name__ == '__main__':

# decimal value

dec_val = 24

# Calling function

DecimalToBinary(dec_val)

Step-by-step explanation:

User Zack
by
4.8k points