Need help in trying to write a piece of code that rounds a users integer input to the closest set of predefined numbers.
e.g.
defined values 30, 31, 36, 37
user enters 35
therefore I need some code that will choose the value 36, since its the closest match to the defined values. The only way I could think is a load of if statements. I've been out of touch with C for a while would really appeciate some help.
Thanks