variables
This commit is contained in:
parent
a2791ea2e4
commit
8ebdcaf444
@ -27,23 +27,23 @@ int main() {
|
||||
printf("Súťažiaci č. %d vypil %d pohárov.\n", i + 1, pole[i]);
|
||||
}
|
||||
|
||||
int maxPoharov = pole[0];
|
||||
int pohare = pole[0];
|
||||
int pocetVyhercov = 1;
|
||||
|
||||
for (int i = 1; i < pocetCisel; i++) {
|
||||
if (pole[i] > maxPoharov) {
|
||||
maxPoharov = pole[i];
|
||||
if (pole[i] > pohare) {
|
||||
pohare = pole[i];
|
||||
pocetVyhercov = 1;
|
||||
} else if (pole[i] == maxPoharov) {
|
||||
} else if (pole[i] == pohare) {
|
||||
pocetVyhercov++;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < pocetCisel; i++) {
|
||||
if (pole[i] == maxPoharov) {
|
||||
if (pole[i] == pohare) {
|
||||
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n", i + 1, pole[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user