Update 'cv1/program.c'

This commit is contained in:
Weber 2024-02-21 18:50:25 +00:00
parent f1715bc3eb
commit 444db62bfe

View File

@ -7,13 +7,15 @@ int main() {
while ((ch = getchar()) != EOF) { while ((ch = getchar()) != EOF) {
if (ch == '\n') { if (ch == '\n') {
line_count++; line_count++;
} else { } else if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) {
putchar((ch >= 'a' && ch <= 'z') ? (ch - 32) : ((ch >= 'A' && ch <= 'Z') ? (ch + 32) : (ch >= 32 && ch <= 126 ? ch : '\0'))); putchar((ch >= 'a' && ch <= 'z') ? (ch - 32) : (ch + 32));
} else if (ch >= 32 && ch <= 126) {
putchar(ch);
} }
} }
putchar('\n'); putchar('\n');
printf("\nLines count: %d\n", line_count); printf("Lines count: %d\n", line_count);
return 0; return 0;
} }