From c34e51c132f7c5a4dc23313649335110be813c34 Mon Sep 17 00:00:00 2001 From: ct453rn Date: Wed, 21 Feb 2024 14:35:41 +0100 Subject: [PATCH] uloha1 --- cv1/program.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/cv1/program.c b/cv1/program.c index 15a8b47..17cef6b 100644 --- a/cv1/program.c +++ b/cv1/program.c @@ -5,21 +5,27 @@ int main() { int lines_count = 0; while ((c = getchar()) != EOF) { - if (c == '\n') { - - lines_count++; - } else if (c >= 'a' && c <= 'z') { - + + if (c >= 'a' && c <= 'z') { + c = c - 'a' + 'A'; - } else if (c >= 'A' && c <= 'Z') { - - c = c - 'A' + 'a'; } + else if (c >= 'A' && c <= 'Z') { + + c = c - 'A' + 'a'; + } + + else if (c == '\n') { + + lines_count++; + } + putchar(c); } - printf("Lines Count: %d\n", lines_count); + + printf("\nLines Count: %d\n", lines_count); return 0; }