Computer Science

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

Python

Python Functions

1 Like

Answer

def display_multiples(n, count = 1):
    if count > 4:
        return
    print(n * count)
    display_multiples(n, count + 1)

n = int(input("Enter the number: "))
display_multiples(n)

Output

Enter the number: 11
11
22
33
44

Answered By

2 Likes


Related Questions