Table of Contents

fmod

    double fmod(double, double );

returns the remainder of a statement

cpp Sourcecode Example

#include <iostream> /* including standard library */
#include <cmath> /* including math library */
 
using namespace std;
int main ( void ) 
{
    double y,x;
    x = 9;
    y = 4.2;
 
    //cout.setf(ios::fixed, ios::floatfield);
    cout.precision(8);
 
    cout << "rest of " << x << " / " << y << " is " << fmod(x,y) << endl;
    return 0;
}

output

 rest of 9 / 4.2 is 0.6