0
input and output
in the part formatting output there are these number 3.2, 8.5, -8.5 in the example print out Pi. what is the meaning?
1 Answer
+ 6
Decimal numbers can have up to 15 decimal spaces and you may sometimes want to round them.
The lesson offers an easy way to round floats:
printf("Pi = %8.5f", 3.14159);
%8.5f means that the float will be rounded to 5 decimal numbers, and if the integer part has less than 8 digits, they will be replaced with spaces.