Computer Science, asked by rekha1972mishra, 6 months ago

Write the following programs in Python:

Program to find the sum of the natural numbers from 21 to 30 (both
numbers inclusive)​

Answers

Answered by shashidubey1119
15

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)

Answered by ak1466733
4

Answer:

sum of natural number up to =16in num<0:

print("enter a positive number")

else:sum=0# use while loop to iterate until 0 while (num>0):sum +=num .num -=1

print("the sum is " ,sum).

Similar questions