Write the definition of a function max that has three int parameters and returns the largest.

Write the definition of a function max that has three int parameters and returns the largest.

LANGUAGE: C++

CHALLENGE:

Write the definition of a function max that has three int parameters and returns the largest.

SOLUTION:


int max(int a, int b, int c){
    int max = a;
    if (b>a)
        max = b;
    if (c>max)
        max = c;

    return max;
}

Add comment