Skip to content
← Back to Community
6.5. While: Length of sequence
Profile icon
pole55

Given a sequence of non-negative integers, where each number is written in a separate line. Determine the length of the sequence. The sequence ends with 0. Print the length of the sequence (not counting the 0). The numbers following the number 0 should be omitted.

Example input
1
7
9
0
5

Example output
3

Voters
Profile icon
J08094-LeoLeo
Profile icon
jillnoorily
Profile icon
bruh02
Profile icon
SD10ZZ739386
Profile icon
simisola
Profile icon
Serena06
Profile icon
f877877
Profile icon
PaulaKristianaK
Profile icon
CobyP
Profile icon
a41087