PROGRAM statistik;
USES WINCRT;
VAR
x:array[1..100] of real;
rata,va: real;
n,i: integer;
BEGIN
write ('masukkan banyaknya percobaan, n = ');
readln (n);
for i :=1 to n do
begin
write ('n ke' ,i,' = ');
readln (x [i]);
end;
rata:=0;
for i:=1 to n do
rata:=rata + x [i] ;
writeln('mean = ',rata/n:2:2);
va := 0 ;
for i:= 1 to n do
va := ( va + (sqr((x [i]) -( rata/n)))) / (n-1) ;
writeln ('varians = ',va:2:2) ;
writeln ( 'standar deviasi = ', sqrt (va):2:2)
end.
USES WINCRT;
VAR
x:array[1..100] of real;
rata,va: real;
n,i: integer;
BEGIN
write ('masukkan banyaknya percobaan, n = ');
readln (n);
for i :=1 to n do
begin
write ('n ke' ,i,' = ');
readln (x [i]);
end;
rata:=0;
for i:=1 to n do
rata:=rata + x [i] ;
writeln('mean = ',rata/n:2:2);
va := 0 ;
for i:= 1 to n do
va := ( va + (sqr((x [i]) -( rata/n)))) / (n-1) ;
writeln ('varians = ',va:2:2) ;
writeln ( 'standar deviasi = ', sqrt (va):2:2)
end.
Contoh output program Pascal penghitung statistik deskriptif |