C - Rounding integer division up (instead of truncating)
Posted
by Dave
on Stack Overflow
See other posts from Stack Overflow
or by Dave
Published on 2010-03-11T05:20:36Z
Indexed on
2010/03/20
10:21 UTC
Read the original article
Hit count: 117
I was curious to know how I can round a number to the nearest tenth whole number. For instance, if I had:
int a = 59 / 4;
which would be 14.75 calculated in floating point; how can I store the number as 15 in "a"?
© Stack Overflow or respective owner