From fe9d5084c02956bba31630c2ea2b828c343738aa Mon Sep 17 00:00:00 2001 From: Bohdan Yanchyk Date: Sat, 29 Feb 2020 23:14:45 +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 | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/du1/program.c b/du1/program.c index 58a5474..91b50f0 100644 --- a/du1/program.c +++ b/du1/program.c @@ -1,5 +1,20 @@ #include int main(){ -printf("Hello, world!"); +char word; + + for (int count = 0; (word = getchar()) != EOF;) { + if (word >= 'a'&&word <= 'z') { + word -= 32; + } + else if (word >= 'A'&&word <= 'Z'){ + word += 32; + } + if (word == '\n') { + count++; + printf("\nPočet riadkov: %d\n", count); + } + putchar(word); + + } return 0; }