Relative efficiency of n tasks in 1 loop vs. 1 task each in n loops?

Say I have 3 simple tasks, to find the min, the max, and the average of an array of numbers.

A modular approach would be to write one function for each, thus iterating over the array thrice. However, that seems wasteful when all the information can be collected in a single iteration.

I understand that both approaches take 3n time but am wondering if one approach is better than the other in the general case and why.

You can use a function to compute all of them. You can find in this post the implementation of min and max with each other using 3n/2 - 2 comparison instead of 2n. Also, summing the values in the meanwhile of iterating over the whole of the data. It's the minimum number of iteration and comparison over data.