/* showf_pt.c -- 以两种方式显示浮点值*/
#include <stdio.h>
int main (void)
{
float aboat = 32000.0;
double abet = 2.14e9;
long double dip = 5.32e-5;
printf ("%f can be written %e\n",aboat,aboat);
printf ("%f can be written %e\n",abet,abet);
printf ("%f can be written %e\n",dip,dip);
return 0;
}
输出结果如下:
32000.000000 can be written 3.200000e+04
2140000000.000000 can be written 2.140000e+09
0.000053 can be written 5.320000e-05
本文探讨了C语言中浮点数的多种输出格式,包括标准格式、指数格式等,通过实例展示了如何使用printf函数进行不同形式的输出。
922

被折叠的 条评论
为什么被折叠?



