program Menu_Program;
uses crt;
var
a:byte;
i,n,x : integer;
sigmay,sigmax,ratax,ratay,sigma,sigma1,sigma2,cov,varian : real;
rerata,hsl : real;
procedure hapus_layar;
begin
clrscr;
end;
procedure mean;
begin
writeln('Menghitung Mean dari beberapa Data');
writeln('----------------------------------');
write('Masukkan banyak data yang akan di input :');
readln(n);
sigma:=0;
for i:=1 to n do
begin
write('Input x',i,' :');
readln(x);
sigma:=sigma + x;
end;
rerata := sigma/n;
writeln('Mean dari data - data terebut adalah ',rerata:5:2);
readln;
end;
procedure varians;
begin
writeln('Menentukan Varians');
writeln('------------------');
write('Masukan banyak data : ');
readln(n);
while n<2 do
begin
writeln('Banyak data harus lebih dari 2');
write('Masukkan banyak data : ');
readln(n);
end;
sigma1 := 0;
sigma2 := 0;
for i := 1 to n do
begin
write('Masukkan data',i,' : ');
readln(x);
sigma1:=sigma1 + x;
sigma2:=sigma2 + (x*x);
end;
hsl :=(n*sigma2 - (sigma1*sigma1))/(n*(n-1));
writeln('Varians = ',hsl:5:2);
readln;
end;
procedure covar;
var
x,y,px,py,k : array [1..100] of real;
begin
write('n = '); readln(n);
sigmax := 0;
sigmay := 0;
for i := 1 to n do
begin
write('x = '); readln(x[i]);
write('y = '); readln(y[i]);
sigmax := sigmax + x[i];
sigmay := sigmay + y[i];
end;
ratax := sigmax/n;
ratay := sigmay/n;
sigma := 0;
for i := 1 to n do
begin
px[i] := x[i] - ratax;
py[i] := y[i] - ratay;
k[i] := px[i]*py[i];
sigma := sigma + k[i];
end;
Download source code lengkapnya di sini..
Ini contoh prosedur program statistik..Keren kan..
Label
- Adekdik Software (1)
- Aplikasi Iseng (16)
- C++ (7)
- Download (2)
- Excel (1)
- Google Map (1)
- Iseng (1)
- Nambah ilmu (32)
- Pascal (20)
- Super Iseng (2)
- VB .Net (21)
- VB 6 (1)
Senin, 27 April 2009
Contoh penggunaan procedure pada Turbo Pascal
Label: Pascal
Langganan:
Posting Komentar (Atom)
1 komentar:
mas, ada materi olimpiade komputer sma nggak??
visit : jendule.blogspot.com
Posting Komentar