TUGAS BU MARLIZA No.7

Senin, 05 April 2010
program :
uses crt;
function ratarata (A : array of integer):real;
var i,jml,bnykdata : integer;
begin
jml := 0;
bnykdata := 0;
for i := low (A) to high (A) do begin
jml := jml + A [i];
inc(bnykdata);
end;
ratarata := jml/bnykdata;
end;
function simpanbaku (A : array of integer):real;
var i,bnykdata : integer;
ratarata,jml : real;
begin
ratarata := ratarata ;
jml := 0;
bnykdata := 0;
for i := low (A) to high (A) do
begin
jml := jml + sqrt (A [i] - ratarata);
inc (bnykdata);
end;
simpanbaku := sqrt (jml/bnykdata);
end;
var arr : array [1..8] of integer;
begin
clrscr;
arr [1] := 12;
arr [2] := 6;
arr [3] := 7;
arr [4] := 3;
arr [5] := 15;
arr [6] := 10;
arr [7] := 18;
arr [8] := 5;
writeln('ratarata : ', ratarata(arr):0:2);
writeln('simpanganbaku : ', simpanbaku(arr):0:2);
readln;
end.


output :











tugas no. 7
nama : aisyah purnamasari & nurmala febriyanti putri
kelas : 1KA22

0 komentar:

Posting Komentar

About me