Hi, I have been trying to solve this problem for a while now. I wrote a program that analyzes 3 numbers entered by a user. All calculations are working fine. Now I am attempting to use 'if' statements to display the largest and smallest number entered.
I am adjusting the code to determine the smallest number entered so I will just post the code to determine the largest. I know I must not be covering all the possiblities to determine the largest and smallest numbers entered. Can someone give me some guidance?
// determines the smallest entered number
result = "";
if ( number1 > number2 && number3 > number2)
result = result + number2;
if ( number1 < number2 && number3 > number2)
result = result + number1;
if ( number1 < number2 && number3 < number1)
result = result + number3;
// determines the largest entered number
result2 = "";
if ( number1 > number2 && number3 > number1)
result2 = result2 + number3;
if ( number1 < number2 && number3 < number2)
result2 = result2 + number2;
if ( number1 > number2 && number2 > number3)
result2 = result2 + number1;