38 lines
		
	
	
		
			927 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			927 B
		
	
	
	
		
			C
		
	
	
	
	
	
| #include <stdio.h>
 | |
| #include <stdbool.h>
 | |
| 
 | |
| int main() {
 | |
|     int results[50], count = 0, num, maxPoharov = 0;
 | |
| 
 | |
|     while (count < 50 && scanf("%d", &num) == 1) {
 | |
|         // Kontrola platnosti vstupu
 | |
|         if (num < 1 || num > 50) {
 | |
|             printf("Chyba: Neplatné číslo %d. Prosím, zadajte číslo v rozsahu 1 až 50.\n", num);
 | |
|             continue;
 | |
|         }
 | |
| 
 | |
|         results[count++] = num;
 | |
|     }
 | |
| 
 | |
|     if (count == 0) {
 | |
|         printf("Chyba: Málo platných hodnôt.\n");
 | |
|         return 0;
 | |
|     }
 | |
| 
 | |
|     for (int i = 0; i < count; i++) {
 | |
|         printf("Súťažiaci č. %d vypil %d pohárov.\n", i + 1, results[i]);
 | |
|         if (results[i] > maxPoharov) {
 | |
|             maxPoharov = results[i];
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     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);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     return 0;
 | |
| }
 |