Update 'cv2/program.c'
This commit is contained in:
parent
a11eba70f8
commit
b61828b8d6
@ -1,17 +1,21 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
int results[50], count = 0, num, maxPoharov = 0;
|
int results[50];
|
||||||
|
int count = 0, num;
|
||||||
|
int maxPoharov = 0;
|
||||||
|
int maxIndex = -1;
|
||||||
|
|
||||||
while (count < 50 && scanf("%d", &num) == 1) {
|
while (count < 50 && scanf("%d", &num) == 1) {
|
||||||
if (num < 1) {
|
if (num <= 0) {
|
||||||
|
break;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
results[count++] = num;
|
results[count] = num;
|
||||||
if (num > maxPoharov) {
|
if (num > maxPoharov) {
|
||||||
maxPoharov = num;
|
maxPoharov = num;
|
||||||
|
maxIndex = count;
|
||||||
}
|
}
|
||||||
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
@ -19,9 +23,12 @@ int main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < count; i++) {
|
if (maxIndex != -1) {
|
||||||
if (results[i] == maxPoharov) {
|
|
||||||
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n", i + 1, maxPoharov);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user