# if the given range is 10
given_range = 10
 
# set up a variable to store the sum
# with initial value of 0
sum = 0
 
for i in range(given_range):
 
        # if i is odd, add it
        # to the sum variable
        if i%2!=0:
                sum= sum+i
                print(sum)
 
# print the total sum at the end

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: