pvjc23/du1/program.c

34 lines
647 B
C
Raw Permalink Normal View History

2023-02-23 12:17:36 +00:00
#include <stdio.h>
int main(){
int c= 0;
int n=0; // pocet nacitanych znakov
while(1){
c = getchar();
if(c!=-1){ //-1 eof koniec vstupu
if( c >= 'a' && c <= 'z'){ //porovnavam cisla v ascii tabulke
c=c+'A'-'a'; //velke pismeno na male
}
else if(c >= 'A' && c <= 'Z'){
c=c-'A'+'a'; //male pismeno na velke
}
2023-02-23 14:50:08 +00:00
else if(c=='\n'){
n++;
}
2023-02-23 12:17:36 +00:00
}
else{
break;
}
putchar(c);
2023-02-23 14:42:01 +00:00
2023-02-23 12:17:36 +00:00
}
2023-02-23 14:42:54 +00:00
printf("\n");
2023-02-23 14:50:08 +00:00
printf("Počet riadkov: %d\n", n); //vypise pocet zpouzitych znakov
2023-02-23 12:17:36 +00:00
return 0;
2023-02-23 13:01:38 +00:00
2023-02-23 12:17:36 +00:00
}