Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var X : array [0..5]of real = (-3.2, 3.33, -2.8, 2.95, -3.01, 0);
- Y : array [0..4] of real = (5.1, -4.8, 4.99, -5.01, 5.4);
- Z : array [0..3] of real = (-1.44, -1.5, 1.80, -1.77);
- sr_arif1, sr_arif2, sr_arif3, min : real;
- function sr_arif ( a : array of real; n : integer ) : real;
- var i : integer;
- sum, cnt : real;
- begin
- cnt := 0;
- sum := 0;
- for i := 0 to n - 1 do
- begin
- if a[i] < 0 then
- begin
- cnt := cnt + 1;
- sum := sum + a[i];
- end;
- end;
- sr_arif := sum / cnt;
- end;
- begin
- sr_arif1 := sr_arif(X, 6);
- sr_arif2 := sr_arif(Y, 5);
- sr_arif3 := sr_arif(Z, 4);
- min := sr_arif1;
- if sr_arif2 < min then
- begin
- min := sr_arif2;
- end;
- if sr_arif3 < min then
- begin
- min := sr_arif3;
- end;
- writeln(sr_arif1);
- writeln(sr_arif2);
- writeln(sr_arif3);
- writeln(min);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement