Merge branch 'master' of git.kemt.fei.tuke.sk:ah174ig/pvjc22
This commit is contained in:
commit
b1408889c6
24
du1/program.c
Normal file
24
du1/program.c
Normal 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
47
du2/program.c
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user