in reply to Re^2: find min, max and average
in thread find min, max and average

Copy and modify your search for the minimum to find the maximum, and output the maximum after that.

After you have found the minimum and maximum, you can use almost the same technique you used to find the minimum and the maximum to also calculate the average.