fmod() 您所在的位置:网站首页 c语言中fmod函数 fmod()

fmod()

2024-07-16 17:39| 来源: 网络整理| 查看: 265

C库函数double fmod(double x, double y)返回x除以y的剩余的值。 

声明

以下是fmod() 函数的声明。 

double fmod(double x, double y) 参数

x -- 这是除法分子IEX浮点值 i.e. x.

y -- 这是浮动点值除法分母iey

返回值

这个函数返回除以x / y的剩余值。

例子

下面的例子显示了 fmod()函数的用法。

#include #include int main () { float a, b; int c; a = 9.2; b = 3.7; c = 2; printf("Remainder of %f / %d is %lf ", a, c, fmod(a,c)); printf("Remainder of %f / %f is %lf ", a, b, fmod(a,b)); return(0); }

让我们编译和运行上面的程序,这将产生以下结果:

Remainder of 9.200000 / 2 is 1.200000 Remainder of 9.200000 / 3.700000 is 1.800000

上一篇: floor() - C函数 下一篇: - C语言标准库


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有