Example 1: Round Off to Another Integer's Multiple

Learn how to round off an integer to another integer's multiple.

Problem

Write a program to predict the smallest multiple of j but it should be larger than i.

Example

Input (i, j) Output
256, 7 259
996, 4 1000

Try it yourself

Try to solve this question on your own in the code widget below. If you get stuck, you can always refer to the solution provided.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.