diff --git a/du1/program.c b/du1/program.c new file mode 100644 index 0000000..5e61b41 --- /dev/null +++ b/du1/program.c @@ -0,0 +1,32 @@ +#include +#include + +void printCharacter(int c); + +int main() { + int lineCount = 0; + int c; + char outChar; + + while((c = getchar()) != EOF) { + if (c >= 'a' && c <= 'z') { + outChar = c - 'a' + 'A'; + } else if (c >= 'A' && c <= 'Z') { + outChar = c - 'A' + 'a'; + } else { + if (c == '\n') { + lineCount++; + } + + outChar = c; + } + + printCharacter(outChar); + } + + printf("\nPočet riadkov: %d\n", lineCount); +} + +void printCharacter(int c) { + printf("%c", c); +}