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