Изменил(а) на 'du1/program.c'

This commit is contained in:
Vladyslav Korzun 2023-02-17 12:12:22 +00:00
parent 12db2cbebd
commit 4b8f51c1a1

View File

@ -2,34 +2,23 @@
#include <stdlib.h>
#include <ctype.h>
int main(){
int count = 0;
int c = 0;
int count = 0;
int riadok = 0;
int pop = 0;
while(c != EOF){
c = getchar();
if((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')){
if (c >= 'a' && c <= 'z' && count == 0){
c = c - 32;
printf("%c", c);
count++;
riadok++;
}
if (c >= 'A' && c <= 'Z' && count == 0){
c = c + 32;
printf("%c", c);
riadok++;
}
pop++;
}
else{
if(c != 10 && pop == 0){
if(islower(c)){
c = toupper(c);
printf("%c\n", c);
riadok++;
count++;
}
}
pop = 0;
count = 0;
if(isupper(c) && count == 0){
c = tolower(c);
printf("%c\n", c);
riadok++;
}
count = 0;
}
printf("\nPočet riadkov: %d\n", riadok);
return 0;