17 lines
357 B
Text
17 lines
357 B
Text
module Averages;
|
|
type
|
|
Vector = array {math} * of real;
|
|
|
|
procedure ArithmeticMean(x: Vector): real;
|
|
begin
|
|
(* sum is a predefined function for mathematical arrays *)
|
|
return sum(x)
|
|
end ArithmeticMean;
|
|
var
|
|
x: Vector;
|
|
|
|
begin
|
|
x := new Vector(4);
|
|
x := [1.0, 2.3, 3.2, 2.1, 5.3];
|
|
write("arithmetic mean: ");writeln(ArithmeticMean(x):10:2)
|
|
end Averages.
|