Question: Create an interactive program using 1 user defined function, 1 counting loop, 1 input validation loop, and an array.You need to create a program that

Create an interactive program using 1 user defined function, 1 counting loop, 1 input validation loop, and an array.You need to create a program that fills in an array of doubles and calculates the average of the array. Declare the doubles array to be a size of 30. Ask the user for how many doubles they would like to add to the array (maximum of 30, the size of the array). Store this value into a variable called count. Implement a loop to make sure that the user enters a value within this range (1-30). Fill the array in the main function with user input, one double at a time, before passing it to the Array_Avg function. Store these doubles in an array called arr. The value of count and the array will be passed to a function called Array_Avg. Return the average to the main function and print out the average.Please refer to the following prototype and example output.double Array_Avg (double arr[], int count);//prototype//Array_Avg function takes in a double array (double arr[]) and the number of doubles within the array (int count) from the main function//returns the average of the array (double) to the main function//the average of the array should be printed out by the main functionExample output:Please enter the number of elements in your array: 4Please enter number 1 out of 4: 23.5Please enter number 2 out of 4: 45.6Please enter number 3 out of 4: 78.9Please enter number 4 out of 4: 110.5The average of the array is 64.62

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!