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
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:]
Comments
Leave a comment