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, 21.06.2019 20:30
What important technology has done the most to allow a businesses a chance to compete with larger international companies
Answers: 1
question
Computers and Technology, 22.06.2019 10:40
5. illustrate how fine-line inventory classification can be used with product and market segments. what are the benefits and considerations when classifying inventory by product, market, and product/market?
Answers: 2
question
Computers and Technology, 23.06.2019 00:30
Knowing that the central portion of link bd has a uniform cross sectional area of 800 mm2 , determine the magnitude of the load p for which the normal stress in link bd is 50 mpa. (hint: link bd is a two-force member.) ans: p = 62.7 kn
Answers: 2
question
Computers and Technology, 23.06.2019 09:10
Effective character encoding requires standardized code. compatible browsers. common languages. identical operating systems.
Answers: 1
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, 09.06.2021 18:50
question
Engineering, 09.06.2021 18:50
question
Mathematics, 09.06.2021 18:50
Questions on the website: 13722363