#3. Sum of n Natural Numbers
------------------------------
num = int(input(“Enter value of n: ”))
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
--------------------
Enter value of n: 3
The sum is 6
Enter value of n: 5
The sum is 15