Merge branch 'master' of git.kemt.fei.tuke.sk:ah174ig/pvjc22

This commit is contained in:
Andrii Hermaniuk 2022-03-17 20:23:48 +01:00
commit b1408889c6
2 changed files with 71 additions and 0 deletions

24
du1/program.c Normal file
View File

@ -0,0 +1,24 @@
#include<stdio.h>
int main(){
int counter=0, Sym;
char OutSym;
while(1){
Sym=getchar();
if(Sym=='\n'){
counter++;
}
if(Sym==EOF){
//counter++;
break;
}
else if(Sym<='Z'&&Sym>='A')Sym +=32;
else if(Sym<='z'&&Sym>='a')Sym-=32;
//counter++;
OutSym=Sym;
putchar(OutSym);
}
printf("\nPočet riadkov: %d\n",counter);
return 0;
}

47
du2/program.c Normal file
View File

@ -0,0 +1,47 @@
#include<stdio.h>
#include<string.h>
#define VELKOST_POLA 90
int main(){
int value = 0;
int count = 0;
int pole[VELKOST_POLA];
memset(pole,0,VELKOST_POLA*(sizeof(int)));
int max_hodnota=0;
int idx=0;
while (1){
int r=scanf("%d",&value);
if(r!=1 || idx==VELKOST_POLA || value < 0){
break;
}
pole[idx]=value;
if (pole[idx] > max_hodnota){
max_hodnota = pole[idx];
}
idx++;
count++;
}
if (count==0){
printf("Chyba: Málo platných hodnôt.\n");
return 0;
}
for(int i=0; i<VELKOST_POLA;i++){
if(pole[i]>0){
printf("Súťažiaci č. %d vypil %d pohárov.\n", i+1, pole[i]);
}
}
for(int i=0; i<VELKOST_POLA;i++){
if(pole[i]==max_hodnota){
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n",i+1, max_hodnota);
}
}
return 0;
}