All pastes #276412 Raw Edit

Mine

public text v1 · immutable
·published 2006-12-12 08:57 UTC
rendered paste body
Programming Challenges 13:  

Indefinite Loops 1

 

 

Programming Challenge #13-2:

Write a program which prompts the user to enter a series of integers and determines the largest and smallest of the numbers entered.  The user signals that there are no more numbers to input by entering the value -999999.  (This challenge is a slight modification of #9 “Greatest and Least of These” on page 310.)

 

Sample Run #1:

This program will determine the largest and smallest of the integers that you enter.  You can enter any number of integers.

            Signal that there are no more inputs by entering -999999

Enter a number:  123

Enter a number:  -5

Enter a number:  85

Enter a number:  -10

Enter a number:  176

Enter a number:  23

Enter a number:  98

Enter a number:  -23

Enter a number:  115

Enter a number:  -999999

 

The largest number is 176

The smallest number is -23

 

Sample Run #2:

This program will determine the largest and smallest of the integers that you enter.  You can enter any number of integers.

            Signal that there are no more inputs by entering -999999

Enter a number:  47

Enter a number:  -999999

 

The largest number is 47

The smallest number is 47

 

Sample Run # 3:

This program will determine the largest and smallest of the integers that you enter.  You can enter any number of integers.

            Signal that there are no more inputs by entering -999999

Enter a number:  -999999