recursive python program to print numbers from n to 1

Solutions on MaxInterview for recursive python program to print numbers from n to 1 by the best coders in the world

showing results for - "recursive python program to print numbers from n to 1"
Lucy
17 Jan 2019
1# Read the input
2n = int(input())
3
4def rec(n):
5    if n==0:
6        print(0)
7    else:
8        print(-n)
9        rec(n-1)
10        print(n)
11
12rec(n)