This commit is contained in:
Macko 2024-02-22 14:31:54 +01:00
parent cb587235fc
commit cca3e0833b

View File

@ -1,26 +1,32 @@
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
int main() { int main() {
int lines_count = 0;
int c; int c;
int lines_count = 0;
while ((c = getchar()) != EOF) { while ((c = getchar()) != EOF) {
if (islower(c)) { // Check if the character is a lowercase letter
putchar(toupper(c)); if (c >= 'a' && c <= 'z') {
} else if (isupper(c)) { // Convert lowercase to uppercase
putchar(tolower(c)); c = c - 'a' + 'A';
} else { }
putchar(c); // Check if the character is an uppercase letter
if (c == '\n') { else if (c >= 'A' && c <= 'Z') {
// Convert uppercase to lowercase
c = c - 'A' + 'a';
}
// Check if the character is an end of line
else if (c == '\n') {
// Increment line count
lines_count++; lines_count++;
} }
}
// Output the character
putchar(c);
} }
printf("Počet načítaných riadkov: %d\n", lines_count); // Print the number of lines read
printf("Lines count: %d\n", lines_count);
return 0; return 0;
} }