C 语言实例 – 输出浮点数

C语言教程评论

C 语言实例 - 输出浮点数

使用 printf() 与 %f 输出浮点数。

#include <stdio.h>

int main() {
   float f;             // 声明浮点数变量

   f = 12.001234;       // 定义浮点数变量

   printf("f 的值为 %f", f);

   return 0;
}

输出结果:文章源自公式库网-https://www.gongshiku.com/html/202112/c-yuyanshili-shuchufudianshu.html

f 的值为 12.001234
文章源自公式库网-https://www.gongshiku.com/html/202112/c-yuyanshili-shuchufudianshu.html文章源自公式库网-https://www.gongshiku.com/html/202112/c-yuyanshili-shuchufudianshu.html
运营不易,
感谢支持!
weinxin
我的微信
我的微信公众号
我的微信公众号扫一扫
weinxin
我的公众号
 最后更新:2021-12-7
公式库网
  • 本文由 公式库网 发表于 2021年12月4日21:54:13
  • 转载请务必保留本文链接:https://www.gongshiku.com/html/202112/c-yuyanshili-shuchufudianshu.html

发表评论