Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

recursive python program to print numbers from n to 1

# Read the input
n = int(input())

def rec(n):
    if n==0:
        print(0)
    else:
        print(-n)
        rec(n-1)
        print(n)

rec(n)
 
PREVIOUS NEXT
Tagged: #recursive #python #program #print #numbers
ADD COMMENT
Topic
Name
3+5 =