modf: returns the fractional portion and place the integer part in *i : modf « math.h « C / ANSI-C






modf: returns the fractional portion and place the integer part in *i


    

//Declaratin: float modff(float num, float *i); 
              double modf(double num, double *i); 
              long double modfl(long double num, long double *i);  
//Function:   decomposes num into its integer and fractional parts. 
 

    
  
 
 
  #include <math.h>
  #include <stdio.h>

  int main(void)
  {
     double i;
     double f;

     f = modf(10.123, &i);
     printf("%f %f",i , f);
  }

         
/*
10.000000 0.123000*/ 

           
       








Related examples in the same category