Answer to Question #227337 in Python for srikanth

Question #227337
Multiple of 5

You are given 

N inputs. Print the given inputs until you encounter a multiple of 5.

Input

The first line of input is an 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

After 

3, we have encountered 5, which is a multiple of 5.

So, the output should be 

1
2
3
Sample Input 1
6
1
2
3
5
9
6
Sample Output 1
1
2
3
Sample Input 2
5
1
2
3
4
5
Sample Output 2
1
2
3
4

1
Expert's answer
2021-08-20T13:41:35-0400
N = int(input())
numbers=[]
for i in range(0,N):
    n = int(input())
    if n % 5 != 0:
        numbers.append(n)
    else:
        break
        
for n in numbers:
    print(n)





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