subject

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.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 21:30
The graph shows median weekly earnings for full-time workers according to education level. which can you not conclude?
Answers: 2
question
Computers and Technology, 23.06.2019 08:30
Helen's credit card has an apr of 15.32% and a grace period of 17 days and helen pays her balance in the full every month. if her last billing cycle ended on september 26, 2009, and she made her payment on october 11, 2009, did she owe any interest on her last statement's balance?
Answers: 3
question
Computers and Technology, 23.06.2019 14:30
Choose the answers that best complete each sentence. on average,are more expensive than other kinds of postsecondary schools. the cost of room and board includes. to save money, some students attend auniversity in their home state.
Answers: 2
question
Computers and Technology, 23.06.2019 19:30
2. fluorine and chlorine molecules are blamed fora trapping the sun's energyob forming acid rainoc producing smogod destroying ozone molecules
Answers: 2
You know the right answer?
4. Write a program of two functions. The main function asks the user to enter 5 numbers and stores t...
Questions
question
Mathematics, 25.01.2021 21:00
question
Mathematics, 25.01.2021 21:00
question
Mathematics, 25.01.2021 21:00
Questions on the website: 13722362