funguje
This commit is contained in:
parent
a2371a5c8b
commit
8daddff125
31
cv2/program.c
Normal file
31
cv2/program.c
Normal file
@ -0,0 +1,31 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user