From 2d047c0e76fac5d96c6d940bfd70dfd7e4b358b4 Mon Sep 17 00:00:00 2001 From: Vladyslav Korzun Date: Sun, 19 Feb 2023 10:35:52 +0000 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8=D0=BB(?= =?UTF-8?q?=D0=B0)=20=D0=BD=D0=B0=20'du1/program.c'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du1/program.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/du1/program.c b/du1/program.c index e0be92b..57e6c0b 100644 --- a/du1/program.c +++ b/du1/program.c @@ -5,37 +5,28 @@ int main(){ int c = 0; int count = 0; int riadok = 0; -int pop = 0; while(c != EOF){ c = getchar(); if(c == EOF){ break; +} + if (c == '\n') { +putchar(c); +riadok++; } if((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')){ -if(islower(c)){ + if(islower(c)){ c = toupper(c); printf("%c\n", c); riadok++; count++; } -if(isupper(c) && count == 0){ + if(isupper(c) && count == 0){ c = tolower(c); printf("%c\n", c); riadok++; } -pop++; } -if(c == 10){ -printf("\n"); -riadok++; -} -else{ -if(pop == 0){ -printf("%c\n", c); -riadok++; -}} -count = 0; -pop = 0; } printf("\nPočet riadkov: %d\n", riadok); return 0;