Precision floating point number in C language to two decimal places of the statement is as follows
1 2 |
|
Description: The% 9.2f
Output field indicates a width of the float 9, which is 2 decimal places, 6 integer bits, if the default is a wide field 9 for the actual number of bits
Specifier
% D decimal signed integer
Decimal% u unsigned integer
% F float
% S string
% C single character
% P value pointer
Floating-point exponential% e
% X,% X unsigned integer expressed in hexadecimal
% O unsigned integer in octal representation
% G output from the output values of the small length in accordance with the% f% e, or output mode type
% P output address character
% lu 32 bit unsigned integer
% llu 64 bit unsigned integer
Example:
main ()
{
a float A;
Scanf ( "% F", & A);
the printf (. "%. 2F", A); // output two decimal floating-point number.
}