Ask 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 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. 7 February, 06:57
    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 & 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