How can decimals not be rounded
2 views (last 30 days)
That is my code.
float_number = input('Please enter a float point number: ');
fprintf("The number is %.2f\n",float_number);
Please enter a float point number: 5.126
The number is 5.13
When the user enters a decimal, the result only keeps two decimal places, but I don't want the last decimal place to be rounded.
I don't want 5.13. I want 5.12.
How to do it?