Ask Question

g Write a line of code to invoke a function named RandNum, which accepts no parameters, and storing the return value in a variable called num (which has already been defined). Separate each item with 1 space (except around the parentheses), and end the line with a semi-colon.

+3
Answers (1)
  1. 17 April, 18:12
    0
    public int RandNum ();

    * Assuming it returns an integer

    Explanation:

    I believe you mean to write the function header of randNum.

    To write the header of the function, we need to specify its return type, name, parenthesis and parameters inside the parenthesis - if exist.

    If it returns an integer it should have int, if it returns a double it should have double in the header. In the answer, I assumed it returns an integer.

    The name is already given, RandNum

    Since, the function does not take any parameter, inside of the parenthesis will be empty.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “g Write a line of code to invoke a function named RandNum, which accepts no parameters, and storing the return value in a variable called ...” 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