Programming Code Center(PCC)
[PYTHON]

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

File Name : Sum_of_Natural_Numbers.py

# Sum of natural numbers up to num

num = 16

if num < 0:
   print("Enter a positive number")
else:
   sum = 0
   # use while loop to iterate until zero
   while(num > 0):
       sum += num
       num -= 1
   print("The sum is", sum)

Output :

Sum_of_Natural_Numbers.jpg