Ask Question

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

+1
Answers (2)
  1. 1 April, 07:11
    0
    Solution:

    The definition of a function max that has three int parameters and returns the largest is given bellow:

    def max (x, y, z):

    if (x>z and x>y):

    return (x)

    elif (y>x and y>z):

    return y

    else:

    return z

    Thus this is required right answer.
  2. 1 April, 08:03
    0
    int max (int x, int y, int z) {

    if (x > y && x > z)

    return x;

    else if (y > x && y > z)

    return y;

    else

    return z;

    }

    Explanation:

    I am going to write a c function for this.

    The arguments are the values, and it is a int function because it returns an integer. So

    The if clause is used to verify the largest value.

    int max (int x, int y, int z) {

    if (x > y && x > z)

    return x;

    else if (y > x && y > z)

    return y;

    else

    return z;

    }
Know the Answer?