Answer to Question #288146 in Python for Suganya

Question #288146

You are given n inputs write a python program to print the numbers that are multiples of 3.


Input:

The first line of input is integer N.

The next N lines each contain an integer as input.


Explanation:

In the given example, there are 6 inputs . 1,2,3,5,9,6. The numbers 3,9,6 are multiples of 3.

So the output, should be


3

9

6


Sample Input 1

6

1

2

3

5

9

6

Sample Output 1

3

9

6

Sample Input 2

4

1

3

6

8

Sample Output 2

3

6


1
Expert's answer
2022-01-17T08:25:27-0500
def Multiple_3(Num):
    for r in range(0,len(Num)):
        if(Num[r]%3==0):
            print(Num[r])
        
Input1 = [1,2,3,5,9,6]
Input2 = [4,1,3,6,8]


print("Sample Input-1: ",Input1)
print("Sample Output-1: ")
Multiple_3(Input1)


print("\nSample Input-2: ",Input2)
print("Sample Output-2: ")
Multiple_3(Input2)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS