From 3b6f064f659b6d4cf041b1f41c6044640a37d358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Wed, 6 Mar 2024 13:52:05 +0100 Subject: dn02b.fix --- "\305\241ola/p2/dn/DN01b_63230317.c" | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git "a/\305\241ola/p2/dn/DN01b_63230317.c" "b/\305\241ola/p2/dn/DN01b_63230317.c" index cebcc83..6952c95 100644 --- "a/\305\241ola/p2/dn/DN01b_63230317.c" +++ "b/\305\241ola/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; } -- cgit v1.2.3