Middle Multiple(s) of 10
Coding Problem Keys
Middle Multiple(s) of 10
Problem Statement
The program must accept two integers M and N as the input. The program must print the middle multiple of 10 among the multiples of 10 from M to N. If the number of multiples is even, the program must print the middle two multiples of 10 as the output. If there is no multiple of 10 from X to Y, the program must print -1 as the output.
Boundary Condition(S)
Input Format
Output Format
Example Input/Output 1
Input
Output
Explanation
Example Input/Output 2
Input
Output
Explanation
Example Input/Output 3
Input
Output
Note: Max Execution Time Limit: 500 millisecs
Solution
Programming Language: Python 3 Language
m,n=map(int,input().split())
s=[]
for i in range(m,n+1):
if(i%10==0):
s.append(i)
k=len(s)
if(len(s)==0): print("-1")
elif(k%2==0): print(s[k//2-1],s[k//2])
elif(k%2!=0): print(s[k//2])
# Published By PKJCODERS
(Note: Incase If the code doesn't Pass the output kindly comment us with your feedback to help us improvise.)
Comments