var numbers: array[1..10] of integer; sum, sumSquares, mathExpectation, variance: real; i: integer;
begin sum := 0; sumSquares := 0; mathExpectation := 0; variance := 0;
// заполнение массива случайными числами от 1 до 10 for i := 1 to 10 do begin numbers[i] := Random(10) + 1; sum := sum + numbers[i]; sumSquares := sumSquares + sqr(numbers[i]); end;
program MathExpectationAndVariance;
var
numbers: array[1..10] of integer;
sum, sumSquares, mathExpectation, variance: real;
i: integer;
begin
sum := 0;
sumSquares := 0;
mathExpectation := 0;
variance := 0;
// заполнение массива случайными числами от 1 до 10
for i := 1 to 10 do
begin
numbers[i] := Random(10) + 1;
sum := sum + numbers[i];
sumSquares := sumSquares + sqr(numbers[i]);
end;
mathExpectation := sum / 10;
variance := (sumSquares / 10) - sqr(mathExpectation);
writeln('Numbers: ');
for i := 1 to 10 do
writeln(numbers[i]);
writeln('Mathematical Expectation: ', mathExpectation:0:2);
writeln('Variance: ', variance:0:2);
end.