This commit is contained in:
Michal Utľák 2024-02-14 16:36:27 +01:00
parent 8395394b6b
commit a1a819fa6b

View File

@ -1,6 +1,29 @@
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
int main(){ int main() {
printf("Hello World!\n"); int ch;
return 0; int visibleChars = 0;
printf("Zadajte text (ukoncite vstup s Ctrl+D):\n");
while ((ch = getchar()) != EOF) {
if (islower(ch)) {
ch = toupper(ch);
} else if (isupper(ch)) {
ch = tolower(ch);
}
if (isprint(ch) || ch == '\n') {
putchar(ch);
if (ch != '\n') {
visibleChars++;
}
}
}
printf("\nPocet načítaných riadkov: %d\n", visibleChars);
return 0;
} }