This commit is contained in:
Kozar 2024-02-28 13:29:57 +01:00
parent cf1436966a
commit c8bc3e152b

View File

@ -3,21 +3,22 @@
#define FIELD_SIZE 52 #define FIELD_SIZE 52
int main(){ int main(){
int field[FIELD_SIZE] = {0}; // Inicializujte poľo na 0 int field[FIELD_SIZE] = {0};
int count = 0; int count = 0;
int max_num = 0; int max_num = 0;
int input; int input;
while (count < FIELD_SIZE) { while (count < FIELD_SIZE) {
if (scanf("%d", &input) != 1) {
break;
}
if (input < 0) { if (input < 0) {
printf("Ukoncenie zadavania.\n");
break; break;
} }
field[count] = input; field[count] = input;
count++; count++;
} }
printf("Vypisane hodnoty:\n");
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
printf("Sutaziaci č. %d vypil %d pohárov.\n", i + 1, field[i]); printf("Sutaziaci č. %d vypil %d pohárov.\n", i + 1, field[i]);
} }