Reference no: EM13168077
Requirements:
- The program must accept positive and negative numbers in its input sequence, and ?nd the largest and smallest
of the numbers entered whether they are all positive, all negative, or a combination of both positive and negative.
- Entering 0 must terminate the input sequence and cause the result to be displayed.
- If the ?rst number entered is zero, then the input sequence is empty and a message stating this must be
displayed (as shown in the sample run below) instead of showing the largest and smallest numbers.
- Name the source ?le for your program program2.c
- The prompts and output displayed by the program must be formated as shown in the sample run below (e.g.
blank lines, spacing, case of text).
- A sample run of the program with only positive numbers:
Entering 0 will terminate the sequence of input values.
Enter a number: 9
Enter a number: 5.2
Enter a number: 44
Enter a number: 0
Your largest number was 44.000. Your smallest number was 5.200.
- A sample run of the program with only negative numbers:
Entering 0 will terminate the sequence of input values.
Enter a number: -4
Enter a number: -38
Enter a number: -5.6
Enter a number: 0
Your largest number was -4.000. Your smallest number was -38.000.
- A sample run of the program with both positive and negative numbers:
Entering 0 will terminate the sequence of input values.
Enter a number: 6
Enter a number: 78
Enter a number: -3
Enter a number: 0
Your largest number was 78.000. Your smallest number was -3.000.
- A sample run of the program with an empty input sequence:
Entering 0 will terminate the sequence of input values.
Enter a number: 0
Your input sequence was empty.Hints:
- How will you keep track of whether or not any numbers have been entered? Think about what variables you
need.
- What needs to be done di?erently when the ?rst number is read compared to when later numbers are read?
- Are the above two items related?