Question: 4. Write a program of two functions. The main function asks the user to enter 5 numbers and stores them in an array. Then the

4. Write a program of two functions. The main function asks the user to enter 5 numbers and stores them in an array. Then the main function should pass the array to the second function calcAvg!). The function calcAvg will calculate the average of the array and return the result to the main function. Finally, the main function will display the average on the screen. (30%) You may assume that the user only enters numbers, not letters or symbols. Therefore there is no input failure. Hint: (1) The calcAvg) function should take 2 parameters, one is for the array, the other is for the size of the array. (2) Use a for loop to compute the sum, and divide it by the size to get the average. If you prefer, you can read the 5 numbers from a file, and write the average to another file
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
