From 8daddff1259b516daa3f1473b242f0e5c27fc4da Mon Sep 17 00:00:00 2001 From: Mykyta Sadchenko Date: Wed, 28 Feb 2024 22:33:18 +0100 Subject: [PATCH] funguje --- cv2/program.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 cv2/program.c diff --git a/cv2/program.c b/cv2/program.c new file mode 100644 index 0000000..ae6c4f1 --- /dev/null +++ b/cv2/program.c @@ -0,0 +1,31 @@ +#include + +#define MAX_SUTAZIACI 10 + +int main() { + int pocetPoharov[MAX_SUTAZIACI] = {0}; + int maxPoharov = 0; + int cisloSutaziaceho = 0; + int vypitiePoharov; + + + printf("Zadajte počet vypitých pohárov pre každého súťažiaceho:\n"); + while (scanf("%d", &vypitiePoharov) == 1) { + pocetPoharov[cisloSutaziaceho] = vypitiePoharov; + if (vypitiePoharov > maxPoharov) { + maxPoharov = vypitiePoharov; + } + cisloSutaziaceho++; + } + + + printf("Súťažiaci s maximálnym počtom pohárov (%d):\n", maxPoharov); + for (int i = 0; i < cisloSutaziaceho; i++) { + if (pocetPoharov[i] == maxPoharov) { + printf("%d ", i); + } + } + printf("\n"); + + return 0; +}