TCS OA-11 2024
Problem Description
Write a program that takes two integers, X
and Y
, as inputs. The program should find and print the number that is closest to X
and is divisible by Y
.
Input Format
- The first line contains two integers X and Y.
Output Format
Print the number which is nearer the integer when divided by Y.
Constraints
- 1 ≤ X, Y ≤ 10⁵
Example
Sample Input:
X = 25
Y = 4
Sample Output:
24
Explanation:
The closest number to 25 that is divisible by 4 is 24.