Ask Question
8 January, 09:16

Write the definition of a function square, which receives an integer parameter and returns the square of the value of the parameter. So if the parameter's value is 7, the function returns the value 49. If the parameter's value happens to be 25, the functions returns the value 625. If the value of the parameter is 0, the function returns 0.

+2
Answers (1)
  1. 8 January, 12:35
    0
    public static int square (int num) {

    return num*num;

    }

    Explanation:

    Using the Java Programming Language, we declare a function named square as stated in the question, the return type of the function is stated as integer. And the the parameter it receives is an integer number called num.

    To get the square of the number we use the expression num*num, and return the the squared value. When the function is called, it will receive one argument (an integer value), it will calculate the square and return it.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write the definition of a function square, which receives an integer parameter and returns the square of the value of the parameter. So if ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers