Write a program using functions where a function collects


Write a program using functions where a function collects 8 numbers from the user, finds the largest, smallest of those 8 numbers and uses passing by reference to update the variables belonging to the main program.

Then the main program calls a function called CollectNumbers() and passes the variables largest, smallest BYREF(by reference). The CollectNumbers() return the average back to the main.

Here is what the functions should accomplish.

'main program.
Creates variables largest, smallest, average.
Calls CollectNumbers() function and sends variables largest, smallest BYREF(by reference)
The CollectNumbers() function should return the average.
The main displays the average returned by the function and , smallest and largest variables updated by the function.

Function CollectNumbers() receives largest and smallest by reference.
The purpose of this function is to take 8 numbers from the user.
Find the largest, smallest and the average of those numbers.
The function puts the largest of the 8 numbers in received parameter largest and the smallest of those 8 numbers in the received parameter smallest.
Then, Send the average back to the main.

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Write a program using functions where a function collects
Reference No:- TGS0920107

Expected delivery within 24 Hours