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
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}')
Comments
Leave a comment