Обновить du1/program.c

This commit is contained in:
Bohdana Marchenko 2025-02-27 10:59:43 +00:00
parent d6dae4e82d
commit 4777e86b00

View File

@ -19,12 +19,9 @@ int main() {
}
int max_value = results[0];
int winner_index = 0;
for (int i = 1; i < count; i++) {
if (results[i] > max_value) {
max_value = results[i];
winner_index = i;
}
}
@ -32,8 +29,11 @@ int main() {
printf("Súťažiaci č. %d vypil %d pohárov.\n", i + 1, results[i]);
}
// Vypíše víťaza
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n", winner_index + 1, max_value);
for (int i = 0; i < count; i++) {
if (results[i] == max_value) {
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n", i + 1, results[i]);
}
}
return 0;
}