Write a sentinel loop that repeatedly prompts the user to enter a number and, once the number
Question:
Write a sentinel loop that repeatedly prompts the user to enter a number and, once the number –1 is typed, displays the maximum and minimum numbers that the user entered. Here is a sample dialogue:
Type a number (or –1 to stop): 5
Type a number (or –1 to stop): 2
Type a number (or –1 to stop): 17
Type a number (or –1 to stop): 8
Type a number (or –1 to stop): –1
Maximum was 17
Minimum was 2
If –1 is the first number typed, no maximum or minimum should be printed. In this case, the dialogue would look like this:
Type a number (or –1 to stop): –1
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Building Java Programs A Back To Basics Approach
ISBN: 9780135471944
5th Edition
Authors: Stuart Reges, Marty Stepp
Question Posted: