top of page
Writer's pictureRajesh Singh

Python Program to Convert Decimal to Binary using recursive function



def decitobin(n):

if n > 1:

decitobin(n // 2)

print(n % 2,end='')

num = int(input("Enter any decimal number: "))

decitobin(num)


Output:

Enter any decimal number: 42

>

101010>




114 views0 comments

Recent Posts

See All

Comments


bottom of page