In this program, we will find the sum of natural numbers using Python.
Steps to solve the program
- Create a count variable and assign its value equal to 1.
- Create a total variable and assign its value equal to 0.
- While the value of the count variable is less than 11 add the count variable to the total.
- Add 1 to the count variable after each iteration.
- Print the output.
count = 1
total = 0
while count<11:
total += count
count += 1
print("Total: ",total)
Output :
Total: 55