Ask Question
25 September, 20:02

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.

+1
Answers (1)
  1. 25 September, 21:19
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers