Update 'cv1/program.c'

This commit is contained in:
Tamáš 2024-02-21 15:38:23 +00:00
parent 37c601b2ee
commit 63ceb32dc7

View File

@ -5,14 +5,15 @@ int main() {
int lines_count = 0; int lines_count = 0;
while ((c = getchar()) != EOF) { while ((c = getchar()) != EOF) {
if (c >= 'a' && c <= 'z') { if (c >= 'a' && c <= 'z') {
c = c - 'a' + 'A'; c = c - 'a' + 'A';
} }
else if (c >= 'A' && c <= 'Z') { else if (c >= 'A' && c <= 'Z') {
c = c - 'A' + 'a'; c = c - 'A' + 'a';
} }
if (c == '\n') { if (c == '\n') {
lines_count++; lines_count++;
} }
@ -20,6 +21,10 @@ int main() {
putchar(c); putchar(c);
} }
if (lines_count > 0) {
putchar('\n');
}
printf("Lines count: %d\n", lines_count); printf("Lines count: %d\n", lines_count);
return 0; return 0;