Menu Close

Finding the multiple in Python …FTC

Find the multiple of given number in the list of integers.

Input:
First Line of the Input is the Number of Elements in the List
Second Line of Input has the elements of the List
Third line has has the number for which you have to find the multiples

Output:
Print the Multiples

INPUT
5
6  7  8  13  11
3

OUTPUT
6
N = int(input("Number of Elements: "))
L1 = list(map(int,input("Enter the Elements: ").split(" ")))
Div = int(input("Divisible Number: "))
print("Multiples: ")
for i in range(N):
    if L1[i] % Div==0:
        print(L1[i])

INPUT_1:
Number of Elements:  5
Enter the Elements:  6  7  8  13  11
Divisible Number:  3

OUTPUT:
Multiples:
6


INPUT_2:
Number of Elements:  8
Enter the Elements:  2  4  5  3  7  9  24  10
Divisible Number:  2

OUTPUT:
Multiples:
2
4
24
10


ILLUSTRATION

Executed using python 3