0

About c++

How do we round numbers in c++ ??

24th Mar 2020, 3:04 PM
Immortal Soul
Immortal Soul - avatar
3 odpowiedzi
0
#include <math.h> int i=round(4.3)
24th Mar 2020, 3:28 PM
Jayakrishna 🇮🇳
0
Ok tnx man
24th Mar 2020, 3:30 PM
Immortal Soul
Immortal Soul - avatar
0
You can also use ceil() to round up or floor to round down(). ceil(x) is pretty much equivalent to round(x+0.5) while floor(x) is round(x-0.5) (if x is a signed).
24th Mar 2020, 4:38 PM
xaralampis_
xaralampis_ - avatar