From dd44de490bb28faf95cc292879c582d080f7885f Mon Sep 17 00:00:00 2001 From: Bohdan Yanchyk Date: Sun, 1 Mar 2020 09:23:10 +0000 Subject: [PATCH] =?UTF-8?q?Aktualizovat=20=E2=80=9Edu1/program.c=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du1/program.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/du1/program.c b/du1/program.c index ceace3f..5c38cb3 100644 --- a/du1/program.c +++ b/du1/program.c @@ -1,9 +1,12 @@ #include -int main(){ + + + +int main() { char word; - + int i = 0; for (int count = 0; (word = getchar()) != EOF;) { if (word >= 'a'&&word <= 'z') { word -= 32; @@ -12,15 +15,18 @@ int main(){ word += 32; } if (word == '\n') { - count++; - for (int i = 0; i <= count; i++) { - printf("\n"); + while (word + i == '\n') { + count++; + i++; } - printf("Počet riadkov: %d", count); + i = 0; + printf("\nPočet riadkov: %d", count); + count = 0; } putchar(word); - - } - + } return 0; + } + +