pvjc24/cv1/program.c

19 lines
417 B
C
Raw Normal View History

2024-02-21 18:26:40 +00:00
#include <stdio.h>
int main() {
char ch;
2024-02-21 18:47:30 +00:00
int line_count = 1;
2024-02-21 18:26:40 +00:00
while ((ch = getchar()) != EOF) {
if (ch == '\n') {
line_count++;
} else {
putchar((ch >= 'a' && ch <= 'z') ? (ch - 32) : ((ch >= 'A' && ch <= 'Z') ? (ch + 32) : (ch >= 32 && ch <= 126 ? ch : '\0')));
}
}
2024-02-21 18:45:33 +00:00
putchar('\n');
printf("Lines count: %d\n", line_count);
return 0;
2024-02-21 18:26:40 +00:00
}