← Back to challenges

Next Number Greater Than A and B and Divisible by B

JavaScriptHardmathalgebra

Instructions

You are given two numbers a and b. Create a function that returns the next number greater than a and b and divisible by b.

Examples

divisibleByB(17, 8) ➞ 24

divisibleByB(98, 3) ➞ 99

divisibleByB(14, 11) ➞ 22

Notes

a will always be greater than b.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Secret Function 2.0