From a11eba70f84eff55ff2afe216cac89931383d369 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1=C5=A1?= Date: Thu, 29 Feb 2024 09:32:05 +0000 Subject: [PATCH] Update 'cv2/program.c' --- cv2/program.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) 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; } }