Modf Function


  • It is used for decomposing the numbers into its ineger and fractional parts .
  • The returned value is the fractional part .
  • It places the integer part in the argumented variable .

  • Syntax:

    float modff(float num, float *j);
    
    double modf(double num, double *j);
    
    long double modfl(long double num, long double *j);

    Example:

    #include <math.h>
    #include <stdio.h>
    
      int main()
      {
         double j;
         double g;
    
         g = modf(10.123, &j);
         printf("%f %f",j,g);
    
      return 0;
      }
     
    Back