Ask Question

Assume that max2 is a function that expects two int parameters and returns the value of the larger one. Also assume that four variables, population1, population2, population3, and population4 have already been defined and associated with int values. Write an expression (not a statement!) whose value is the largest of population1, population2, population3, and population4 by calling max2.

+5
Answers (1)
  1. 14 May, 17:27
    0
    max2 (max2 (population1, population2), max2 (population3, population4));

    Explanation:

    This expression will give the maximum form the population1, population2, population3, population4. Since max2 can only accept two integer variables. So we have to use nested max2 function. I have used 3 max2 functions. One max2 finds the maximum from population1 and population2 second max2 finds the maximum from population3 and population4 and the last max2 finds the maximum from the results of first max2 and second max2.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Assume that max2 is a function that expects two int parameters and returns the value of the larger one. Also assume that four variables, ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers