7 kyu
Simple Fun #181: Rounding
257 of 636myjinxin2015
Description:
Task
Round the given number n
to the nearest multiple of m
.
If n
is exactly in the middle of 2 multiples of m, return n
instead.
Example
For n = 20, m = 3
, the output should be 21
.
For n = 19, m = 3
, the output should be 18
.
For n = 50, m = 100
, the output should be 50
.
Input/Output
[input]
integern
1 ≤ n < 10^9.
[input]
integerm
3 ≤ m < 109
.
[output]
an integer
Fundamentals
Similar Kata:
Stats:
Created | Mar 6, 2017 |
Published | Mar 6, 2017 |
Warriors Trained | 1273 |
Total Skips | 19 |
Total Code Submissions | 4263 |
Total Times Completed | 636 |
JavaScript Completions | 257 |
PHP Completions | 66 |
C# Completions | 70 |
Python Completions | 263 |
Ruby Completions | 40 |
Total Stars | 14 |
% of votes with a positive feedback rating | 88% of 197 |
Total "Very Satisfied" Votes | 160 |
Total "Somewhat Satisfied" Votes | 27 |
Total "Not Satisfied" Votes | 10 |
Total Rank Assessments | 9 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 7 kyu |
Lowest Assessed Rank | 7 kyu |