This blog is under construction

Monday, 30 April 2012

fmod example in C

Header file:
    math.h

Synopsis:
     double fmod(double x, double y);

Description:
     It returns the floating-point remainder of x/y.


fmod function C example:


  #include<stdio.h>
  #include<math.h>
  int main() {
        double x, y, res;
        printf("Enter the value for x and y:\n");
        scanf("%lf%lf", &x, &y);
        res = fmod(x,y);
        printf("Remainder:%lf\n", res);
        return 0;
  }



  Output:
  jp@jp-VirtualBox:~/cpgms/math$ ./a.out
  Enter the value for x and y:
  15  4
  Remainder: 3.000000


No comments:

Post a Comment