C Language Examples - Output a floating-point number
Use printf() and %f to output a floating-point number.
Example
#include
<
stdio.h
int
main
(
)
{
float
f;
// Declare a floating-point variable
f
=
12
.001234
;
// Define a floating-point variable
printf
(
"
The value of f is %f
"
,
f
)
;
return
0
;
}
Output result:
f 的值为 12.001234
C Language Examples