28 double pole10[] = {1,2,3,4,5,90,80,77,60,50};
29 double pole7[] = {1,2,3,4,5,6,7};
30 double pole_noinit[5];
33 #define NELEM(arr) (sizeof arr/sizeof arr[0])
35 double pole_prumer_arith(
double pole[],
size_t sz) {
41 for (i=0, suma=0.0; i<
sz; i++) {
47 double pole_suma(
double pole[],
size_t sz) {
51 for (i=0, suma=0.0; i<
sz; i++) {
57 double pole_min(
double pole[],
size_t sz) {
62 if (pole[i] < min) min = pole[i];
68 double pole_max(
double pole[],
size_t sz) {
73 if (pole[i] > max) max = pole[i];
80 void pole_vypis(
double pole[],
size_t sz) {
82 printf(
"Pole obsahuje cisla");
83 for (i=0; i<
sz; i++) {
84 printf(
"%c %g", i?
',':
':', pole[i]);
91 double pole_noinit_local[5];
93 pole_vypis(pole7,
NELEM(pole7));
94 result = pole_prumer_arith(pole7,
NELEM(pole7));
95 printf(
"Prumer pole je: %g\n", result);
96 printf(
"Suma pole je: %g\n", pole_suma(pole7,
NELEM(pole7)));
100 pole_vypis(pole10,
NELEM(pole10));
101 result = pole_prumer_arith(pole10,
NELEM(pole10));
102 printf(
"Prumer pole je: %g\n", result);
103 printf(
"Suma pole je: %g\n", pole_suma(pole10,
NELEM(pole10)));
104 printf(
"Maximum pole je: %g\n", pole_max(pole10,
NELEM(pole10)));
105 printf(
"Minimum pole je: %g\n", pole_min(pole10,
NELEM(pole10)));
107 pole_vypis(pole_noinit,
NELEM(pole_noinit));
108 pole_vypis(pole_noinit_local,
NELEM(pole_noinit_local));