lundi 21 mars 2022

is there a way to round down float type in c++?

i want to ask how could i round down float type variable.
(with using printf)

for example,
float x = 3.35;
printf("%.1f", x);

in this situation, it will print out 3.4 but i want it to print 3.3.
is there any way to do it?
(without using turnc or floor function)

Aucun commentaire:

Enregistrer un commentaire