Answer to Question #185498 in Python for Woyengimiesindo

Question #185498

Write programs with loops that compute the sum of all even numbers between 2 and 100

(inclusive).

Output

Sum of all even numbers from 2 - 100 = 2550


1
Expert's answer
2021-04-26T16:24:03-0400
s = 0
for i in range(2, 101):
    if i%2 == 0:
        s += i
print(f'The sum of all even numbers from 2 - 100 is {s}')

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS