English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

hey guys can't figure out this last question help plz

max is a function that accepts two int parameters and returns the value of the larger one.

Four int variables, population1 , population2 , population3 , and population4 have already been declared and initialized.

Write an expression (not a statement!) whose value is the largest of population1 , population2 , population3 , and population4 by calling max . (HINT: you will need to call max three times and you will need to pass the return values of two of those calls as arguments to max . REMEMBER: write an expression, not a statement.)

2007-02-23 13:38:41 · 1 answers · asked by Alex P 2 in Computers & Internet Programming & Design

1 answers

Largest = max(pop1, max(pop2, max(pop3, pop4));

Computers will sove things acording to PEMDAS (parens, exponents, mult, div, add, sub) so working from the inside out, the larger of pop3 and pop4 is used with max() again to get the larger of pop2 and (3 or 4), and so on.

2007-02-24 13:56:22 · answer #1 · answered by BigRez 6 · 0 0

fedest.com, questions and answers