Computer Science, asked by khoobhis, 11 months ago

wap to print the sum of odd and even number from 1 to 100 in python

Answers

Answered by gaganadithyareddy9
4

Answer:

Hey! Here is your python code...

sum_odds = 0

sum_evens = 0

for i in range(101):

   if i%2 == 1:

       sum_odds+=i

   else:

       sum_evens+=i

       

print('Sum of all odd numbers from 1 to 100 = ', sum_odds)

print('Sum of all even numbers from 1 to 100 = ', sum_evens)

# HOPE THIS HELPS!!

Similar questions