Program Varians

program varians;
uses wincrt;
var i,n:integer;
rata,selisih,varian,sum1,sum2:real;
data:array [1..100] of real;
begin
sum1:=0;
write('banyak data?');readln(n);
writeln('masukkan datanya!');
i:=1;
repeat
write ('data ke-',i,' ');
readln (data[i]);
inc(i);
until i > n;
i:=1;
repeat
sum1:= sum1+data[i];
inc(i);
rata:=sum1/n;
until i > n;
i:=1;
repeat
selisih:= sqr(data[i]-rata);
sum2:= sum2+selisih;
inc(i);
varian:= sum2/(n-1);
until i > n;
writeln (varian);
end.

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

0 komentar:

Posting Komentar