pvjc24/cv1/program.c

24 lines
544 B
C
Raw Normal View History

2024-02-21 18:26:40 +00:00
#include <stdio.h>
int main() {
2024-02-21 19:15:04 +00:00
int 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 19:21:36 +00:00
if (ch >= 'a' && ch <= 'z') {
putchar(ch - 32);
} else if (ch >= 'A' && ch <= 'Z') {
putchar(ch + 32);
2024-02-21 19:39:51 +00:00
} else if ((ch >= 32 && ch < 127) || ch==9){
2024-02-21 19:34:31 +00:00
putchar(ch);
2024-02-21 18:58:37 +00:00
}
2024-02-21 18:26:40 +00:00
}
}
2024-02-21 19:16:57 +00:00
2024-02-21 18:55:50 +00:00
printf("\nLines count: %d\n", line_count);
2024-02-21 19:15:04 +00:00
2024-02-21 18:45:33 +00:00
return 0;
2024-02-21 18:26:40 +00:00
}