Pages

Selasa, 06 Desember 2011

Program rata-rata(mean)

uses wincrt;
var n,i:integer;
mean,simp,jum:real;
dat:array[1..100] of integer;
begin
write('masukkan n: ');
readln(n);
for i:=1 to n do
readln (dat[i]);
for i:=1 to n do
mean:= mean+dat[i];
mean:=mean/n;
writeln;
writeln (mean:0:2);
for i:=1 to n do
jum:=jum+sqr(dat[i]-mean);
simp:=jum/(n-1);
write(simp);
end.

Tidak ada komentar:

Posting Komentar