C/math.h/remainder

Материал из C\C++ эксперт
Перейти к: навигация, поиск

remainder: returns the remainder of a/b

<source lang="cpp">

//Declaration: float remainderf(float a, float b);

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

 
 #include <math.h>
 #include <stdio.h>
 int main(void)
 {
   double x = 10.0, y = 0.0;
   do {
     printf("%f\n", remainder (x, y+1));
     y++;
   } while(y<11.0);
   return 0;
 }
        

/* 0.000000 0.000000 1.000000 2.000000 0.000000 -2.000000 3.000000 2.000000 1.000000 0.000000 -1.000000

  • /
      </source>