Question: Read 5 positive random integer numbers from keyboard in the range of 1 - 1 0 0 0 . Find the sum of first two

Read 5 positive random integer numbers from keyboard in the range of 1-1000. Find the sum
of first two numbers, last two numbers and compare their average with the middle
number(3rd number).If they are same print "1" on to the screen, Find the sum of first and last
number, sum of second n and fourth number and compare average of them with second
number. If they are same print "-1" on the screen. Find the sum of first and fouth number,
sum of second and last number then compare their average with fourth number, if they are
equal print "0" on the screen. And if above constraints are not satisfied print an ERROR
report on the screen.
Hint: Use exception handling mechanism
Sample Input and Output:
Input1: 11211- Output: 1
Input2: 12311- Output: -1
Input3: 11321- Output: 0
Input4: 132545- Output: No constraint is satisfied in c++

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!