pvjc24/cv2/program.c

31 lines
657 B
C
Raw Normal View History

2024-02-22 13:35:42 +00:00
#include<stdio.h>
#define FIELD_SIZE 52
int main(){
2024-02-28 12:23:11 +00:00
int field[FIELD_SIZE] = {0}; // Inicializujte poľo na 0
int count = 0;
int max_num = 0;
int input;
2024-02-22 13:35:42 +00:00
2024-02-28 12:23:11 +00:00
while (count < FIELD_SIZE) {
if (scanf("%d", &input) != 1) {
printf("Chyba pri nacitavani. Koniec vstupu.\n");
break;
}
if (input < 0) {
printf("Ukoncenie zadavania.\n");
break;
}
field[count] = input;
count++;
}
printf("Vypisane hodnoty:\n");
for (int i = 0; i < count; i++) {
printf("Sutaziaci c. %d vypil %d poharov.\n", i + 1, field[i]);
}
return 0;
2024-02-22 13:35:42 +00:00
}