pvjc20/du1/program.c

42 lines
638 B
C
Raw Normal View History

2020-03-06 10:16:53 +00:00
#include<stdio.h>
2020-03-05 17:42:03 +00:00
2020-03-06 10:16:53 +00:00
char change(char inp){
if(inp >= 'A' && inp <= 'Z'){
inp += 'a' - 'A';
return inp;
2020-03-05 19:04:02 +00:00
}
2020-03-06 10:16:53 +00:00
else if(inp >= 'a' && inp <= 'z'){
inp -= 'a' - 'A';
return inp;
2020-03-05 20:17:34 +00:00
}
2020-03-05 17:42:03 +00:00
}
2020-03-05 19:56:29 +00:00
2020-03-06 10:16:53 +00:00
int main(){
char text[255];
int num = 0;
for(int i = 0; text[i] != EOF; i++){
scanf("%c", &text[i]);
}
int len = sizeof(text);
for(int i = 0; i < len; i++){
if(text[i] == '\n') num += 1;
}
for(int i = 0; text[i] != '\n'; i++){
2020-03-06 10:50:22 +00:00
printf("%c", change(text[i]));
2020-03-06 10:16:53 +00:00
}
2020-03-06 10:43:35 +00:00
for(int i = 0; i < num; i++){
2020-03-06 10:16:53 +00:00
printf("\n");
}
printf("Počet riadkov: %d\n", num);
return 0;
}
2020-03-05 20:17:34 +00:00