refresh
This commit is contained in:
		
							parent
							
								
									0ad6253488
								
							
						
					
					
						commit
						7cc282f0c9
					
				@ -1,6 +1,38 @@
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#define celyhodnoty 50
 | 
			
		||||
#define maxcol 50
 | 
			
		||||
 | 
			
		||||
int main() {
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
    int results[maxcol];
 | 
			
		||||
    int count = 0;
 | 
			
		||||
    int num;
 | 
			
		||||
 | 
			
		||||
    while (count < maxcol && scanf("%d", &num) == 1) {
 | 
			
		||||
        if (num < 1) {
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
            results[count] = num;
 | 
			
		||||
            count++;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
            if (count == 0) {
 | 
			
		||||
                printf("Chyba. Malo platnych hodnot.\n");
 | 
			
		||||
                return 1;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            for (int i = 0; i < count; i++) {
 | 
			
		||||
                printf("Sutaziaci c. %d vypil %d poharov.\n",i+1,results[i]);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            int max_value = results[0];
 | 
			
		||||
            for (int i = 1; i < count; i++) {
 | 
			
		||||
                if (results[i] > max_value) {
 | 
			
		||||
                    max_value = results[i];
 | 
			
		||||
                }
 | 
			
		||||
            }        
 | 
			
		||||
                for (int i = 0; i < count; i++) {
 | 
			
		||||
                    if (results[i] == max_value) {
 | 
			
		||||
                        printf("Vyherca je sutaziaci %d ktory vypil %d poharov.\n",i+1,results[i]);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								du1/program.exe
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								du1/program.exe
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
		Loading…
	
		Reference in New Issue
	
	Block a user