In: Computer Science
Design the logic for a program that allows a user to enter 10 numbers, stores the numbers in an array, then displays all of the numbers, the largest number, and the smallest.
create a solution algorithm using pseudocode
create a flowchart
Pseudocode to store numbers in an array from user and print smallest and largest number
Pseudocode:
//declaring array
int array[10];
//reading 10 numbers from user and storing in array
For int i = 0 to 9
{
array[i] = Input num;
}
//assigning min and max to first number in array
int min=array[0], max=array[0];
//displaying all numbers in array
For int i = 0 to 9
{
//displaying each number in the array
Display array[i]
}
For int i = 0 to 9
{
//finding smallest number in array
If array[i] < min
min=array[i]
}
For int i = 0 to 9
{
//finding largest number in array
If array[i] > max
max=array[i]
}
//displaying smallest and largest number in the array
Display min
Display max
Flowchart: