105k views
0 votes
You are to read in a series of numbers into an array of fixed length not to exceed 100 numbers. Your program will stop accepting input when a negative number is input. Once the negative number is input, your program will sort the numbers using a unique sorting algorithm called the bubble sort and output the sorted array and the average (mean).

User OchiWlad
by
8.5k points

1 Answer

4 votes

The given problem requires reading a series of numbers into an array of fixed length and then sorting them using the bubble sort algorithm. Here are the steps to solve the problem:

  1. Declare an array with a fixed length of 100.
  2. Read numbers from the user and store them in the array until a negative number is entered. Stop accepting input at this point.
  3. Implement the bubble sort algorithm to sort the numbers in ascending order.
  4. Output the sorted array to the user.
  5. Calculate the average (mean) of the numbers in the array and output it to the user.

User Fredmaggiowski
by
8.6k points