Answer to Question #233905 in Python for kaavya

Question #233905

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, 6After

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-09-07T06:59:49-0400
N = int(input())
numbers = []
for i in range(N):
    numbers.append(int(input()))
while len(numbers) != 0 and numbers[0] % 5 != 0:
    print(numbers[0])
    numbers = numbers[1:]

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