Python Practice › Loop Programs › Program 71
Sum of the first 10 numbers with while
Write a Python program to find the sum of the first 10 natural numbers using a while loop.
Output
55
Approach
- Add a counter to a total until it passes 10.
Solution
i, total = 1, 0while i <= 10: total += i i += 1print(total)Output
55
Learn the concept
New to this topic? Read the lesson, then come back.