This commit is contained in:
Yaroslav Orlianskyi 2022-03-09 13:53:51 +01:00
parent 8b7b1f1697
commit 12e7288a76
6 changed files with 25 additions and 11 deletions

BIN
du2/.program.c.swl Normal file

Binary file not shown.

BIN
du2/.program.c.swm Normal file

Binary file not shown.

BIN
du2/.program.c.swn Normal file

Binary file not shown.

BIN
du2/.program.c.swo Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,19 +1,33 @@
#include <stdio.h> #include <stdio.h>
#define VELKOST_POLA 52 #define VELKOST_POLA 50
int main(){ int main(){
int results[50]; int results[VELKOST_POLA];
int max; int max;
int vysledky[VELKOST_POLA] = {0,0,0,0}; //int value = 0;
int i = 0; int i = 0;
printf("1 2 3 4 5"); int a = 0;
while(1){ while(1){
scanf("%d", results[i]); int value = 0;
if(results[i] == 1) int r = scanf("%d",&value);
printf("Úspešne som načítal hodnotu %d\n",results[i]); if (r == 1){
else printf("Úspešne som načítal hodnotu %d\n",value);
printf("Načítanie sa nepodarilo. V premennej value ostala pôvodná hodnota. \n"); results[i] = value;
i++; max = results[0];
} if(max < results[i])
max = results[i];
i++;
}else{
do{
printf("Súťažiaci č. %d vypil %d pohárovav.\n", results[a], results[a]);
if(a == i - 1){
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n", max, max);
break;
}
a++;
}while(a < i);
break;
}
}
return 0; return 0;
} }