Sunday 2 December 2012

fmod(x,y) function in C

fmod(x,y) function in C, what is do?


It calculates x modulo y i.e., the remainder of x/y.
This function is the same as the modulus operator, but fmod() performs floating point divisions.

Example:



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

void main ()
{
  printf ("fmod of 16.9 and 13.2 is %lf", fmod (16.9,13.2) );
  getch 0;
}

Output:
1.280303
Explanation:
First two lines are header files which is included to use input/output function i.e., printf 
and mathematical function fmod.
fmod is the function which is used to find out the remainder after division of the 
two floating point numbers.

No comments:

Post a Comment

Best geography books for UPSC prelims, mains

This post is intended to clear the confusion that prevails among the aspirants over how to prepare for UPSC geography and the best books f...