pvjc24/cv1/program.c

21 lines
467 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:48:41 +00:00
int line_count = 0;
2024-02-21 18:26:40 +00:00
while ((ch = getchar()) != EOF) {
if (ch == '\n') {
line_count++;
2024-02-21 18:50:25 +00:00
} else if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) {
putchar((ch >= 'a' && ch <= 'z') ? (ch - 32) : (ch + 32));
2024-02-21 18:52:45 +00:00
}
if (ch == '\n') {
printf("\nLines count: %d\n", line_count);
line_count = 0;
2024-02-21 18:26:40 +00:00
}
}
2024-02-21 18:45:33 +00:00
return 0;
2024-02-21 18:26:40 +00:00
}