summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2024-03-06 13:52:05 +0100
committerAnton Luka Šijanec <anton@sijanec.eu>2024-03-06 13:52:05 +0100
commit3b6f064f659b6d4cf041b1f41c6044640a37d358 (patch)
treea53b6bda4d4f7ad94500d618478bcc05fbd06b12
parentp2.DN01 (diff)
downloadr-3b6f064f659b6d4cf041b1f41c6044640a37d358.tar
r-3b6f064f659b6d4cf041b1f41c6044640a37d358.tar.gz
r-3b6f064f659b6d4cf041b1f41c6044640a37d358.tar.bz2
r-3b6f064f659b6d4cf041b1f41c6044640a37d358.tar.lz
r-3b6f064f659b6d4cf041b1f41c6044640a37d358.tar.xz
r-3b6f064f659b6d4cf041b1f41c6044640a37d358.tar.zst
r-3b6f064f659b6d4cf041b1f41c6044640a37d358.zip
-rw-r--r--šola/p2/dn/DN01b_63230317.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/šola/p2/dn/DN01b_63230317.c b/šola/p2/dn/DN01b_63230317.c
index cebcc83..6952c95 100644
--- a/šola/p2/dn/DN01b_63230317.c
+++ b/šola/p2/dn/DN01b_63230317.c
@@ -16,9 +16,20 @@ void printInt (int a) {
int main (void) {
while (getchar() == '0');
int po_prvi_enici = 0;
- while ((getchar() & ~1) == '0')
- po_prvi_enici++;
- printInt(++po_prvi_enici);
+ int ni_enic = 1;
+ while (1)
+ switch (getchar()) {
+ case '1':
+ ni_enic = 0;;
+ // fall through
+ case '0':
+ po_prvi_enici++;
+ break;
+ default:
+ goto done;
+ }
+ done:
+ printInt(++po_prvi_enici-ni_enic);
putchar('\n');
return 0;
}