6
I need to return a value float with 1 decimal place, but is returning with the rounded value.
I have the following code:
float n1 = 4;
float n2 = 9;
float total = n2 / n1 ;
printf("Media: %.1f ", total ); //aqui, o resultado é 2.3
printf("Media: %.2f", total); //aqui, o resultado é 2.25
The expected value should be Média = 2.2
, but is returning 2.3
.
Is there any solution?
Great question
+1
– Silvio Andorinha