Design a recursive function that accepts an integer argument, n, and prints every second number from n down to a minimum of 0. Assume that n is always a positive integer.
def recursiveFunction(x):
c=1
if(x==0):
print(x)
else:
recursiveFunction(x-1)
if(x%2==0):
print(x)
recursiveFunction(30)
Output:
Comments
Leave a comment