thanks to http://stackoverflow.com/questions/2144459/using-scanf-to-accept-user-input and http://stackoverflow.com/questions/456303/how-to-validate-input-using-scanf for the i/o part. thanks to http://www.haodaima.net/art/137347 for the rounding part…