72.0k views
3 votes
Write the definition of a function divide that takes four arguments and returns no value . The first two arguments are of type int . The last two arguments arguments are pointers to int and are set by the function to the quotient and remainder of dividing the first argument by the second argument . The function does not return a value .The function can be used as follows:int numerator=42, denominator=5, quotient, remainder;divide(numerator,denominator,&quotient,&remainder);/ quotient is now 8 // remainder is now 2 /

User Forforf
by
6.6k points

1 Answer

5 votes

Answer:

The following function definition is from C++ programming language.

//define function with arguments

void divide (int numerator, int denominator, int *quotient, int *remainder)

{

*quotient = (int) (numerator/denominator);

*remainder = numerator % denominator;

}

Step-by-step explanation:

Here, we define a void data type method "divide()" with four arguments in which first two arguments are integer type variables "numerator" and "denominator", next two are pointer type variables "quotient" and "remainder".

After that, we divide the first two integer variables and save result in "*quotient" then, we again use these variables for modulation and save result in "*remainder".

User Montoya
by
6.6k points