← Back to challenges

Next Number Greater Than A and B and Divisible by B

PythonHardmathalgebra

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

divisible_by_b(17, 8) ➞ 24

divisible_by_b(98, 3) ➞ 99

divisible_by_b(14, 11) ➞ 22

Notes

a will always be greater than b.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: How Many Days Between Two Dates