Round To Nearest Multiple
Computer Mathematics
Hard
2 views
Problem Description
Given n and k>0, round n to nearest multiple of k (ties go up).
Input Format
Two integers n k.
Output Format
Rounded multiple.
Official Solution
Compute down = floor(n/k)*k. up = down+k. Compare distances. If equal choose up.
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!