From 87a6b669ef13137c84058f01fe4dcde3a0b96ed5 Mon Sep 17 00:00:00 2001 From: Artem Horbunov Date: Thu, 5 Mar 2020 20:56:29 +0100 Subject: [PATCH] funguje --- du1/program.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/du1/program.c b/du1/program.c index 8f228e8..4f8c961 100644 --- a/du1/program.c +++ b/du1/program.c @@ -1,19 +1,25 @@ #include int main(){ - - char ch; - int num = 'a' - 'A'; - scanf("%c", &ch); - if(ch == EOF || ch == -1){ - return 0; + int c = 0; + while(1){ + char ch; + int num = 'a' - 'A'; + scanf("%c", &ch); + if(ch == 'q' || ch == -1){ + break; + } + c++; + if(ch <= 'A' && ch >= 'Z'){ + ch += num; + c--; + } + else if(ch >= 'a' && ch <= 'z'){ + ch -= num; + c--; + } + printf("%c", ch); } - if(ch >= 'A' && ch <= 'Z'){ - ch += num; - } - else if(ch >= 'a' && ch <= 'z'){ - ch -= num; - } - printf("%c", ch); - + printf("%d\n", c); } +