diff --git a/cv2/program.c b/cv2/program.c index 069a97e..155f23a 100644 --- a/cv2/program.c +++ b/cv2/program.c @@ -1,5 +1,4 @@ #include -#include int main() { int results[50], count = 0, num, maxPoharov = 0; @@ -10,21 +9,19 @@ int main() { continue; } results[count++] = num; + if (num > maxPoharov) { + maxPoharov = num; + } } for (int i = 0; i < count; i++) { printf("Súťažiaci č. %d vypil %d pohárov.\n", i + 1, results[i]); - if (results[i] > maxPoharov) { - maxPoharov = results[i]; - } } for (int i = 0; i < count; i++) { if (results[i] == maxPoharov) { printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n", i + 1, maxPoharov); - - break; } }