Minimum Multiple
Given a collection C1 of ‘n’ positive integers and a number ‘m’ write a C program to find the minimum multiple of m in C1. If no such multiple exist in C1 then print ‘No multiple found’
For example, if there are seven elements 23, 24, 25, 12, 6, 7, 11 and m is 3 then the output should be 6.
Input Format
First line contains the number of elements in the collection C1, n
Next ‘n’ lines contain the elements in the collection C1
Next line contains the value of m
Output Format
Print the minimum multiple of ‘m’ present in C1 or ‘No multiple found’
CODE::
c=[]
for i in range(n):
a=int(input())
c.append(a)
m=int(input())
c.sort()
count=0
for i in c:
if i%m==0:
print(i)
count=1
break
if count==0:
print("No multiple found")
No comments:
Post a Comment