Esistono modi + efficenti...
Perchč:codice:int arrotonda(float n) { return (int) n + 0.5; }
se n % 1 >= 0.5 allora int(n+0.5) = n+1
altrimenti int(n+0.5) = n
senza neanche un if() :bubu:
Esistono modi + efficenti...
Perchč:codice:int arrotonda(float n) { return (int) n + 0.5; }
se n % 1 >= 0.5 allora int(n+0.5) = n+1
altrimenti int(n+0.5) = n
senza neanche un if() :bubu: