Computer Science, asked by masqur97, 15 days ago

Write a python program to add all the first 10 natural numbers by using the for loop.
(Please do not write the wrong answer)

Answers

Answered by vanshika372448
0

Answer:

# 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)

Similar questions