Given three positive integers A, B and C. The task is to find the minimum integer X > 0 such that:
- X % C = 0 and
- X must not belong to the range [A, B]
Input: A = 2, B = 4, C = 2
Input: A = 5, B = 10, C = 4
- If C doesn’t belong to [A, B] i.e. C < A or C > B then C is the required number.
- Else get the first multiple of C greater than B which is the required answer.
Below is the implementation of the above approach:
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- Maximum positive integer divisible by C and is in the range [A, B]
- Minimum decrements to make integer A divisible by integer B
- Minimum positive integer value possible of X for given A and B in X = P*A + Q*B
- Count of index pairs in array whose range product is a positive integer
- Minimum positive integer to divide a number such that the result is an odd
- Minimum integer such that it leaves a remainder 1 on dividing with any element from the range [2, N]
- Minimum elements to be added in a range so that count of elements is divisible by K
- Print first k digits of 1/n where n is a positive integer
- Count pairs in Array whose product is a Kth power of any positive integer
- Count of m digit integers that are divisible by an integer n
- Minimum Possible sum of digits in a positive multiple of N
- Minimum number of changes such that elements are first Negative and then Positive
- Biggest integer which has maximum digit sum in range from 1 to n
- Find an integer in the given range that satisfies the given conditions
- Sum of all numbers divisible by 6 in a given range
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.