C语言基础:printf格式化输出浮点数
#include <stdio.h> int main () { float pi = 3.14159; float radius = 2.0031; printf("The circle's area is %e\n", 2 * pi * radius); printf("The circle's area is %E\n", 2 * pi * radius); return 1; }
gcc编译运行输出:
The circle's area is 1.258584e+01 The circle's area is 1.258584E+01