Why not 123.456000 with float output

CSDN Q & A 2022-01-15 02:18:24

#include <stdio.h>
#include <stdlib.h>
int main()
{
float a=123.456;
printf("%f",a);
return 0;
}




Refer to the answer 1:

No extra at the end will be output 0, If the required output can be written as printf("%.6f",a);




Refer to the answer 2:

thank
Similar articles

2022-01-15

2022-01-15