Python program to find sum of all even numbers between 1 to 10

Python program to find sum of all even numbers between 1 to 10

Python program to find sum of all even numbers between 1 to 10

In this example, we will learn how to calculate the addition of all even numbers from 1 to 10.

#python program to find sum of all even numbers from 1 to 10

n=0
for i in range(1,11)
    if( i % 2 == 0 )
        n = n + i
print( ‘ Sum of Even number = ‘,n)

Output

Sum of Even number = 30

If you like my post please share it with your friends by simply clicking the below social media button, and Don’t forget to comment so we will update ourselves.

Share in a Single Click

Leave a Reply

Your email address will not be published. Required fields are marked *