Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions