Question: Write a program that reads the input repeatedly using a for loop, and then prints the sum of the even and odd integers separately. Note:

Write a program that reads the input repeatedly using a for loop, and then prints the sum of the even and odd integers separately.
Note:
It can get only integer input, any number of inputs are allowed
It should print the sum of even number in the given input and sum of odd numbers in the given input separately
Output:
For the input -11121314151617181920
sum of even: 80,sum of odd: 75
Note:
You have to find the summation of all numbers between 1 to given input
You have to use for loop to solve this problem.
You can use the range function to iterate through loop until the given number
Write a program that reads the input repeatedly

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!