W5 Homework Assignment

You will be required to demo your homework solutions during lab.

1.    Write a program that asks a user to enter three integers and either:

·         displays the message “No solution” if it is not possible to add two of the numbers entered to get the third.  For example, if the user enters 1, 2, and 4, the program should display “No solution”, since  1+2 ≠ 4, 1+4 ≠ 2, and 4+2 ≠ 1.

·         Otherwise, the program displays “__ +__ = __”. For example, if the user enters 1, 4, and 3, the program should display: “1 + 3 = 4”.

·         Hint: this solution requires an approach using if, else if, and else.


2) Write a 2nd version of this program that uses iteration (a while-loop) to keep asking the user for a different set of values as long as no solution is found.