2.17.3.Use the format %f for printing floating numbers |
|
#include <stdio.h>
main()
{
float f1 = 0.23456;
printf("%f \n", f1);
}
|
|
By default, %f prints output with 6 decimal places |
To output with 8 columns and 3 decimal places |
#include <stdio.h>
main()
{
float f1 = 123456789.23456;
printf("%f \n", f1);
printf("%8.3f \n", f1);
}
|
|
123456792.000000
123456792.000 |