Programming Examples

Python program to calculate the sum of odd numbers divisible by 5 from the range 1 to 100


write a program to calculate the sum of odd numbers divisible by 5 from the range 1..100

Solution

sum=0
for i in range (1,101,2):
    if i%5==0:
        sum=sum+i
print("Sum of odd numbers divisible by 5 from range 1 to 100 is : ",sum)
Output/ Explanation:

Sum of odd numbers divisible by 5 from range 1 to 100 is :  500

Latest Current Affairs 2024 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad