C语言基础:浮点数输出代码演示
#include <stdio.h> int main () { float price = 525.75; float sales_tax = 0.06; printf("The item cost is %f\n", price); printf("Sales tax on the item is %f\n", price * sales_tax); return 1; }
gcc编译运行结果
The item cost is 525.750000 Sales tax on the item is 31.545000