Ask Question

Write the definition of a function printLarger, whichhas two int parameters and returns nothing. The functionprints the larger value of the two parameters to standard output ona single line by itself.

+2
Answers (1)
  1. 22 March, 20:15
    0
    void printLarger (int num_1, int num_2) {

    //if else statement for checking the condition

    if (num_1 > num_2) {

    cout<
    }else if (num_1 < num_2) {

    cout<
    }

    }

    Explanation:

    Create the function with return type void, it means the function returns nothing.

    The number will be large if it less than the second number.

    The possible condition are:

    1. number_1 > number_2: the number_1 will be large.

    2. number_1 > number_2: the number_2 will be large.

    In the programming, if-else is the conditional statement which is used for checking the condition and gives the output accordingly.

    Syntax:

    if (condition) {

    statement;

    } else if (condition) {

    statement;

    }

    when the program executes the if statement checks if condition number_1 > number_2 is true or not if true then print the output.

    if the condition false, then the program control move to the else if part and then checks the condition if the condition true then print the output.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write the definition of a function printLarger, whichhas two int parameters and returns nothing. The functionprints the larger value of the ...” 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