Login and get codingWrite a function that accepts a number and a multiple, then rounds the number towards the next multiple.
Examples:
Number Multiple Output 0 5 0 2 5 5 5 5 5 42 5 45 -6 -10 -10 -6 -10 -10 ---
Imagine this on a number line.
* Number: 0 Multiple: 5
-3 -2 -1 0 1 2 3 4 5 0 0
Since zero is a multiple of five the answer is 0.
---
* Number: 2 Multiple: 5
-5 -4 -3 -2 -1 0 1 2 3 4 5 2 => 5
The next multiple of five from two is 5.
---
* Number: -6 Multiple: -10
-10 -9 -8 -7 -6 -5 -4 -3 -2 -1 -6 -10 <=
The next multiple of negative 10 from negative six is -10.
151 out of 153 users completed this Bite.
Will you be the 152nd person to crack this Bite?
Resolution time: ~32 min. (avg. submissions of 5-240 min.)
Our community rates this Bite 3.2 on a 1-10 difficulty scale.
» You can do it! 😌