You are viewing a single comment's thread. Return to all comments →
The rules for rounding off is stated as follows :
If the difference between the grade and the next multiple of 5 is less than 3, round grade up to the next multiple of 5.
If the value of grade is less than 38, no rounding occurs as the result will still be a failing grade.
Since the value 67 is greater than 38 and the difference between value and next multiple of 5 (i.e. 70) is 3 (70 - 67) which is not less than 3, it will not be rounded. Hence, 67 i.e. 'grade' value is printed.
However, for the value 68, the difference is 2 (70 - 68) < 3, so the grade will be rounded to the next multiple by the calculation :
grade + (5 - (grade % 5)) = 68 + (5 - (68 % 5))
= 68 + (5 - 3)
= 68 + 2
= 70 (next multiple of 5)
Hope this helps! :)
Thanks for your time :)