Question: Write a program that takes an array of 10 integer numbers and calculates the average and the sum of the array using two different functions

 Write a program that takes an array of 10 integer numbers

Write a program that takes an array of 10 integer numbers and calculates the average and the sum of the array using two different functions a) (5 pts) Declare and write a function called calcavg. Returns a double, passes the array. Calcavg adds the 10 elements of the array and divides by 10 to return the average Assume there are always 10 elements. Calcavg does not display any result. b) (5 pts) Declare and write a function called calcsum. Returns void. Passes the array and an integer variable by reference. Sums the 10 elements of the array and sets the summation to the variable passed by reference. Calcsum does not display any result. (10 pts). Write a program that has the appropriate headers and variable declarations. program should create an integer array, nums of 10 elements containing the numbers 1,2,3,4,5, 6,7,8,9,10. Please add several comments throughout your program and functions. c) The d) (5 pts). The main program should display the elements of the array using a for loop. The display should look exactly as shown below. Use field width manipulators. e) (5 pts). Call the two functions and display the average and sum of the elements of the array using statements in the main function. The terminal window should look exactly as shown. The elements of nums are: 1 2 3 45 67 8 9 10 The average of nums is 5.50 The sum of nums is 55 Press any key to continue

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 Databases Questions!