pvjc24/cv1/program.c

22 lines
518 B
C
Raw Normal View History

2024-02-21 18:26:40 +00:00
#include <stdio.h>
2024-02-21 19:01:26 +00:00
#include <ctype.h>
2024-02-21 18:26:40 +00:00
int main() {
char ch;
2024-02-21 18:48:41 +00:00
int line_count = 0;
2024-02-21 18:26:40 +00:00
while ((ch = getchar()) != EOF) {
if (ch == '\n') {
2024-02-21 19:02:10 +00:00
putchar('\n');
2024-02-21 18:26:40 +00:00
line_count++;
2024-02-21 18:55:50 +00:00
} else {
2024-02-21 18:58:37 +00:00
if (isprint(ch)) {
putchar((ch >= 'a' && ch <= 'z') ? (ch - 32) : ((ch >= 'A' && ch <= 'Z') ? (ch + 32) : ch));
}
else {
putchar(ch);
}
2024-02-21 18:26:40 +00:00
}
}
2024-02-21 18:55:50 +00:00
printf("\nLines count: %d\n", line_count);
2024-02-21 18:45:33 +00:00
return 0;
2024-02-21 18:26:40 +00:00
}