pvjc20/du1/program.c
2020-03-06 00:36:05 +01:00

33 lines
592 B
C

#include<stdio.h>
#include<stdlib.h>
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);
}