Ask Question

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

+4
Answers (2)
  1. 9 March, 22:23
    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;

    }
  2. 9 March, 22:26
    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.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write the definition of a function max that has three int parameters and returns the largest. ...” 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