#B2024. Floating Point Number Formatting
Floating Point Number Formatting
Floating Point Number Formatting
Given a double precision floating point number, output the number in four different formats on separate lines. The formats are:
%f
: Default format that outputs the number with six decimal places.%f
with five decimal places: Outputs the number with exactly five digits after the decimal point.%e
: Scientific notation.%g
: Compact representation, which may use either fixed-point or scientific notation.
All outputs must exactly match the specified format.
inputFormat
The input consists of a single double precision floating point number.
outputFormat
Output the number in the following four lines:
- Line 1: The number printed using
%f
(six decimal places by default). - Line 2: The number printed using
%f
with 5 decimal places. - Line 3: The number printed using
%e
(scientific notation). - Line 4: The number printed using
%g
(compact representation).
sample
1
1.000000
1.00000
1.000000e+00
1
</p>