Program rata-rata standar deviasi

program rata2_stdev;
uses wincrt;
var i,j,n,a:integer;
k,rata,varian,stdev:real;
begin
writeln('masukkan jumlah data',' ');
i:=1;
readln(n);
while i<=n do begin
write('data ke-',i,'= ');
readln(a);
inc(i);
j:=j+a;
k:=k+sqr(a);
end;
rata:=j/n;
varian:= (k-n*sqr(rata))/(n-1);
stdev:=sqrt((k-n*sqr(rata))/(n-1));
writeln('nilai rata-ratanya = ',rata:2:3);
writeln('nilai variannya adalah = ',varian:2:3);
write('nilai standar deviasinya adalah = ',stdev:2:3);
end.

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 komentar:

Posting Komentar