Write function to roundoff a floating point number to nearest integer.
Code:int roundoff(float x) { if (x >= 0) return (int)(x + 0.5); else if (x < 0) return (int)(x - 0.5); }
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks