Question: Write a program that prompts the user for two integers x and y. Then compute the sum of the even integers and odd integers within

Write a program that prompts the user for two integers x and y. Then compute the sum of the even integers and odd integers within the range of x and y. Your program should output these two sum values. Display an error message and exit the program for the following input values: if x is less than 1 or if y is less than or equal to x.

Sample Output.

Enter x: 1

Enter y: 10

The sum of even integers between 1 and 10 = 30

The sum of odd integers between 1 and 10 = 25

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 Databases Questions!