This commit is contained in:
Džubara 2024-02-25 21:23:20 +01:00
parent aa2877397f
commit 2a8f1f3baf

View File

@ -1,25 +1,29 @@
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
int main() { int main() {
int line_count = 0; int c;
char input_char; int lineCount = 0;
while ((input_char = getchar()) != EOF) { while ((c = getchar()) != EOF) {
if (input_char == '\n') { if (c >= 'a' && c <= 'z') {
line_count++;
c = c - 'a' + 'A';
} else if (c >= 'A' && c <= 'Z') {
c = c - 'A' + 'a';
} }
if (islower(input_char)) { if (c == '\n') {
input_char = toupper(input_char);
} else if (isupper(input_char)) { lineCount++;
input_char = tolower(input_char);
} }
putchar(input_char);
putchar(c);
} }
printf("\nLines␣count:%d\n", line_count);
printf("\nPočet načítaných riadkov: %d\n", lineCount);
return 0; return 0;
} }