Next Multiple - X and Y
Coding Problem Keys
Next Multiple - X and Y
Problem Statement
The program must accept N, X and Y integers as the input. The program must print the next multiple of X and Y after N.
Boundary Condition(s)
1 <= N <= 10⁷
1 <= X, Y <= 100
Input Format
The first line contains N, X and Y separated by a space.
Output Format
The first line contains the next multiple of X and Y after N.
Example Input/Output 1
Input
30 6 5
Output
60
Explanation
The next multiple of 6 and 5 after 30 is 60.
Hence the output is 60.
Example Input/Output 2
Input
20 6 4
Output
24
Note: Max Execution Time Limit: 500 millisecs
Solution
Programming Language: Python 3 Language
n,x,y=map(int,input().split()) while(1): n+=1 if n%x==0 and n%y==0: print(n) break
# Published By PKJCODERS
(Note: Incase If the code doesn't Pass the output kindly comment us with your feedback to help us improvise.)
Comments