# How to use remquo() math function in C++

In this article, we will learn how to use the remquo() math function in C++. This function is associated with the <cmath> library to find the quotient and remainder of a division. This is a preloaded function that has a specific purpose only to find the remainder and quotient of a given numerator and denominator.

We all know the remainder = number â€“ quotient * denominator.

### The syntax: remquo() math function in C++

**datatype remainder= remquo (datatype numerator, datatype denominator, datatype* quotient_pointer);**

It returns the floating-point remainder of numerator/denominator rounded to nearest and stores quotient in q. It is necessary to give all the three arguments otherwise it will give an error. You also can’t provide 0 as a denominator as it will provide a runtime error.

Please see that there can be many return types for this particular function such as long, double or float.

### Algorithm to solve the above problem :

- Start
- Take input(numerator & denominator) as integer or float or double.
- Take remainder=0 and quotient=0.
- remainder = remquo ( numerator, denominator, "ient);
- Print remainder and quotient.
- End

## C++ program to demonstrate remquo() math function

#include <cmath> #include <iostream> using namespace std; int main() { int quotient,numerator,denominator,remaindr; cout<<"Insert the numerator : "; cin>>numerator; cout<<"Insert the denominator : "; cin>>denominator; remaindr = remquo(numerator, denominator, "ient); // the quotient's pointer is used here cout << "Quotient of " << numerator << "/" << denominator << " is " << quotient << endl; cout << "Remainder of " << numerator << "/" << denominator << " is " << remaindr<< endl; return 0; }

#### The output of the above program :

This is a very simple program. I tried my best to do it in the easiest way possible. Hope you like it. If you have any doubts, please comment below.

## Leave a Reply