Esistono modi + efficenti...

codice:
int arrotonda(float n)
{
    return (int) n + 0.5;
}
Perchč:
se n % 1 >= 0.5 allora int(n+0.5) = n+1
altrimenti int(n+0.5) = n

senza neanche un if() :bubu: