Remainder Function


  • The Remainder function is used for finding the remainder for a division .
  • This remainder value can take the values float , double , long double and returns the integer values closest to the numerator (whether -ve or +ve).
  • Positive values are got after the normal division while negative values (for remainder) are got after dividing once more.

  • Syntax:

    float remainderf(float a, float b);
    
    double remainder(double a, double b);
    
    long double remainderl(long double a, long double b); 

    Example:

    #include <math.h>
    #include <stdio.h>
    
      int main()
      {  
    	int a=7,b=3;
        double x = 3.0, y = 2.0;
    
        printf("%f\n", remainder (a, b));
        printf("%f\n", remainder (x, y));
    
        return 0;
    
      }
      
    Back