Programming Code Center(PCC)
[PYTHON]

(PCC)::[How-to-write-Python-Program-to-Find-Sum-of-Natural-Numbers-Using-Recursion]::[python]

File Name : Sum_of_Natural_Numbers_Using_Recursion.py

# Python program to find the sum of natural using recursive function

def recur_sum(n):
   if n <= 1:
       return n
   else:
       return n + recur_sum(n-1)

# change this value for a different result
num = 16

if num < 0:
   print("Enter a positive number")
else:
   print("The sum is",recur_sum(num))

Output :

Sum_of_Natural_Numbers_Using_Recursion.jpg