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

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

Python program to find sum of all odd numbers between 1 to 10
In this example, we will learn how to calculate the sum of all odd numbers between 1 to 10.

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

Output

Sum of Odd number = 25

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 *