Q. Write a program to display first four multiples of a number using recursion.

Answer =

 

def multi(n,x):
    if x == 4 :
        print(n*x)
    else :
        print(n*x,end =",")
        multi(n,x+1)
num = int(input("Enter a number :-"))
multi(num,1)



Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post