Write Python Program to print the Sum of 10 Natural Numbers
Topic: Write Python Program to print the Sum of 10 Natural Numbers
Solution
num = 10 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)
List all Python Programs