I want to print a float with no decimal digits. I know I can use another variable like int and make it the same, but I wanted to avoid that if there is something simpler (like %02f but to limit instead of being at least two digits long).
If there is no way then I'll use a variable int.
Thank you
You want something like
printf("%.0f\n", my_float);
This will tell printf
to include 0 decimal places of precision (you can, of course, use other values as well).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With