41 lines
866 B
C
41 lines
866 B
C
#include <stdio.h>
|
|
#include <stdlib.h>5
|
|
#define VELKOST_POLA 52
|
|
|
|
int main(){
|
|
/*int vysledky[VELKOST_POLA];
|
|
int pocet;
|
|
int max=0;
|
|
int i=0;
|
|
char pole[VELKOST_POLA];
|
|
memset(pole,0,VELKOST_POLA * sizeof(int));
|
|
for(i<vysledky; i++){
|
|
if (pole[i] > max){
|
|
max = pole[i];
|
|
}
|
|
printf("\nSúťažiaci č.%d vypil %d pohárov.\n", i , pole[i]);
|
|
}
|
|
printf("\nVýherca je súťažiaci%d ktorý vypil %d pohárov\n", c , max);
|
|
return 0;
|
|
*/
|
|
int n;
|
|
double arr[100];
|
|
printf("Enter the number of elements (1 to 100): ");
|
|
scanf("%d", &n);
|
|
|
|
for (int i = 0; i < n; ++i) {
|
|
printf("Enter number%d: ", i + 1);
|
|
scanf("%lf", &arr[i]);
|
|
}
|
|
|
|
// storing the largest number to arr[0]
|
|
for (int i = 1; i < n; ++i) {
|
|
if (arr[0] < arr[i]) {
|
|
arr[0] = arr[i];
|
|
}
|
|
}
|
|
|
|
printf("Largest element = %.2lf", arr[0]);
|
|
|
|
return 0;
|
|
} |