Find the sum of natural numbers using Python

In this program, we will find the sum of natural numbers using Python.

Steps to solve the program
  1. Create a count variable and assign its value equal to 1.
  2. Create a total variable and assign its value equal to 0.
  3. While the value of the count variable is less than 11 add the count variable to the total.
  4. Add 1 to the count variable after each iteration.
  5. Print the output.
				
					count = 1
total = 0

while count<11:
    total += count
    count += 1
    
print("Total: ",total)
				
			

Output :

				
					Total:  55
				
			

Print the table of a number using a while loop

multiplication of the first 10 natural numbers

Leave a Comment