zmeny
This commit is contained in:
parent
9cda5110af
commit
85e8add03a
41
du1/program.c
Normal file
41
du1/program.c
Normal file
@ -0,0 +1,41 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#define VELKOST_POLA 52
|
||||
int main() {
|
||||
|
||||
int pole[VELKOST_POLA];
|
||||
|
||||
memset(pole,0,VELKOST_POLA * sizeof(int));
|
||||
|
||||
int participant_count = 0;
|
||||
for (int i = 0; i < VELKOST_POLA; ++i) {
|
||||
int value = 0;
|
||||
int r = scanf("%d", &value);
|
||||
if(r > 0) {
|
||||
pole[i] = value;
|
||||
participant_count++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int best_result = pole[0];
|
||||
|
||||
|
||||
for (int i = 0; i < participant_count; ++i) {
|
||||
printf("Súťažiaci č. %d vypil %d pohárov.\n", i + 1, pole[i]);
|
||||
if(best_result < pole[i]) {
|
||||
best_result = pole[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < participant_count; ++i) {
|
||||
if(pole[i] == best_result) {
|
||||
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n", i + 1, best_result);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user