Rounding
Practice this coding question on Coding Gurukul.
Problem statement
A warehouse display shows stock estimates only in multiples of ten. The inventory service receives an exact nonnegative count n and must choose the displayed count with the smallest absolute error. When two display values are equally close, the warehouse convention is to show the larger one. Your task Round n to the nearest nonnegative multiple of 10, breaking an exact halfway tie upward. Important details A number already ending in zero remains unchanged. A final digit of 5 is a tie and follows the upward rule. Zero is a valid input and output. Print the rounded integer without decimal places or extra labels. Worked example For n = 263, the neighboring multiples are 260 and 270, with errors 3 and 7, so output 260. For n = 265, both errors are 5 and the tie rule chooses 270. For n = 0, the result remains 0.
Input format
Read one integer n.
Output format
Print the rounded count.
Constraints
0 <= n <= 1000000000.
Sample input
263
Sample output
260
Sign in to run or submit a solution in C++, Java or Python.