From e1dd452836b54ee830cf5c82f209acb4d2fb653c Mon Sep 17 00:00:00 2001 From: ct453rn Date: Wed, 21 Feb 2024 14:04:04 +0100 Subject: [PATCH] uloha1 --- cv1/program.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/cv1/program.c b/cv1/program.c index 5833292..0d2eb3d 100644 --- a/cv1/program.c +++ b/cv1/program.c @@ -1,5 +1,29 @@ -#include -int main(){ -printf("Hello World"); +#include +int main() { + int c = 0; + int pocet_riadkov = 0; + + while ((c = getchar()) != EOF) { + if (c >= 'a' && c <= 'z') { + + c = c - 'a' + 'A'; + } else if (c >= 'A' && c <= 'Z') { + + c = c - 'A' + 'a'; + } else if (c == '\n') { + + pocet_riadkov++; + } + + if (c != '\n') { + putchar(c); + } + } + + // Po načítaní všetkých znakov vypíš počet riadkov + printf("\nPocet nacitanych riadkov: %d\n", pocet_riadkov); + + return 0; } +