Print the sum of 1st 10 even numbers using for loop in Python
for Loop - Question 1
In this question, we will see how to print the sum of 1st 10 even numbers in Python programming using for loop. To know more about for loop click on the for loop lesson.
Q1) Write a program in Python to print the sum of 1st 10 even numbers using for loop.
Program
s=0; n=2
for i in range(1,11):
print(n)
s=s+n
n=n+2
print('Sum of 1st 10 even numbers = %d' %(s))
Output
2 4 6 8 10 12 14 16 18 20 Sum of 1st 10 even numbers = 110