program Total_Mean_dan_STD ;
uses crt ;
var
i,n : integer ;
t, m, s, std : real ;
A : array [1..100] of integer ;
ch : char ;
begin
repeat
clrscr ;
write('Banyaknya data : ') ;
repeat
gotoxy(40,1);
clreol ;
readln(n);
until (n>0) and (n<=100);
randomize ;
for i := 1 to n do
begin
A [i] := random (1000);
write(A[i] : 5);
if (i mod 12 =0) then writeln;
end;
t := 0;
s := 0;
for i := 1 to n do
begin
t := t + A[i];
m := t/n;
s := s + sqr(A[i] - m);
std := sqrt(s/(n-1));
end;
writeln; writeln;
writeln('Total : ', t:5:2);
writeln('Mean : ', m:5:2);
writeln('Sigma : ', s:5:2);
writeln('STD : ', std:5:2);
gotoxy(20,24);
writeln('Mau ulang lagi? [Y/N]');
repeat
ch := readkey until upcase(ch) in ['Y' , 'N'];
until upcase (ch) = 'N';
end.
Tidak ada komentar:
Posting Komentar