Program Description
Write a program that reads positive numbers (integers) and stores them into an array.- Write a method to prompt for the input values. (sentinel terminated)
- Write a method to print the array.
- Write a method that returns the value of the smallest number.
- Write a method that returns the value of the largest number.
- Write a method to find the location of a number (array index + 1)
- Write a method to compute the average of the numbers in the array.
- Write a method to output the results.
The input prompt example:
Enter at least 10 unique positive numbers (integers) terminated with a sentinel value (-1)Expected Output
Amount of numbers read: 10Numbers read: 12, 33, 41, 1, 4, 10, 7, 21, 66, 50
Smallest number was 1 in location 4
Largest number was 66 in location 9
Average was 24.5
Comments
Post a Comment