Is there any way to round numbers in C?
I do not want to use ceil and floor. Is there any other alternative?
I came across this code snippet when I Googled f
I think what you're looking for is: int n = (d - floor(d) > 0.5) ? ceil(d) : floor(d);
int n = (d - floor(d) > 0.5) ? ceil(d) : floor(d);