Find The Number N, Where (N+X) Divisible By Y And (N-Y) Divisible By XIn this tutorial, we will learn how to determine the number N, where (N + X) divisible by Y and (N-Y) divisible by X. This is Two numbers, X and Y, are given. Finding the number N(N ≤ 10^18) that meets these two requirements: (N + X) can be divided by Y, and (N - Y) can be divided by X. Examples: The following concept can be used to solve the problem. The number system is a straightforward mathematical idea that we can use. Normalizing the equation allows us to obtain N could be the same as (X*Y - X + Y). Additionally, it meets these two requirements. The solution is therefore (X * Y - X + Y). The application of the aforementioned strategy is seen below: C++ Program 1: Output 780 C++ Program 2: Output 384 Java Code 1: Output 780 Java Code 2: Output 384 C# Code 1: Output 780 C# Code 2: Output 384
So that's the end of the article. I sincerely hope you find this post to be educational and useful. |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India