From 1893ede1a53a528494de6c58efe51668a625b0fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Ut=C4=BE=C3=A1k?= Date: Wed, 21 Feb 2024 14:10:00 +0000 Subject: [PATCH] Update 'cv1/program.c' --- cv1/program.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/cv1/program.c b/cv1/program.c index 51055d6..9b80a82 100644 --- a/cv1/program.c +++ b/cv1/program.c @@ -1,23 +1,22 @@ #include - -#define TAB_WIDTH 7 +#define TAB_WIDTH 7 int main() { int text; int lines_count = 0; while ((text = getchar()) != EOF) { - if (text >= 'a' && text <= 'z') { - text = text - 'a' + 'A'; - } else if (text >= 'A' && text <= 'Z') { - text = text - 'A' + 'a'; - } else if (text == '\n') { + if (text == '\n') { lines_count++; } else if (text == '\t') { for (int i = 0; i < TAB_WIDTH; i++) { putchar(' '); } continue; + } else if (text >= 'a' && text <= 'z') { + text = text - 'a' + 'A'; + } else if (text >= 'A' && text <= 'Z') { + text = text - 'A' + 'a'; } else if (text < 32 || text == 127) { continue; } @@ -27,4 +26,4 @@ int main() { printf("\nLines count: %d\n", lines_count); return 0; -} \ No newline at end of file +}