C函数名:
fmod
功 能: 计算x对y的模, 即x/y的余数,若y是0,则返回NaN。
用 法: double
fmod(double x, double y);
需要头文件:math.h
程序例:
#include
<stdio.h>
#include
<math.h>
int main(void)
{ double x = 5.0, y = 2.0;
double
result;
result =
fmod(x,y);
printf("The remainder of (%lf / %lf) is %lf\n", x, y,
result);
return 0;
}
运行结果是:
The remainder of
(5.000000/2.000000) is 1.000000
转载于:https://www.cnblogs.com/eagleking0318/archive/2010/12/28/6521307.html