+ 1
In c while using float datatype a default number is showing at last.how to remove it?
For example if the required answer is 10.24 then it is showing 10.240001 why this is happening how to remove that 1.
2 Respostas
0
I suggest you can round to a specific precision.
https://www.geeksforgeeks.org/rounding-floating-point-number-two-decimal-places-c-c/
0
here:
#include <stdio.h>
int main()
{
float a = 10.24f;
printf("%.2f", a);
return 0;
}
https://code.sololearn.com/c4PgRNBZ0m1O/?ref=app