Question: I was curious to know how I can round a number to the nearest whole number. For instance, if I had:

```
int a = 59 / 4;

```

which would be 14.75 if calculated in floating point; how can I store the result as 15 in "a"?

Answer: 
You should instead use something like this:

```
int a = (59 - 1)/ 4 + 1;

```

I assume that you are really trying to do something more general:

```
int divide(x, y)
{
   int a = (x -1)/y +1;

   return a;
}

```

x + (y-1) has the potential to overflow giving the incorrect result; whereas, x - 1 will only underflow if x = min\_int...
```
double a=59.0/4;
int b=59/4;
if(a-b>=0.5){
    b++;
}
printf("%d",b);

```

1. let exact float value of 59.0/4 be x(here it is 14.750000)
2. let smallest integer less than x be y(here it is 14)
3. if x-y<0.5 then y is the solution
4. else y+1 is the solution