Bomber Graf!TY Indonesia

Jangan cuma kanvas yang di gambar tembok juga

Array

Prgogram array pada pascal

array

var

tabel:array[1..3,1..2] of byte;

i,j:byte;

begin

tabel [1,2] := 25;

tabel [2,1] := 200;

tabel [2,2] := 50;

tabel [3,1] := 75;

tabel [3,2] := 20;

for i := 1 to 3 do

begin

for j := 1 to 2 do

write (tabel[i,j]:5);

writeln;

end;

readln

end.

Memasukan banyaknya data dengan array

var

i,n:byte;

total,rata:real;

x:array[byte] of real;

begin

write(‘banyak data:’);readln(n);

writeln;

total := 0;

for i := 1 to n do

begin

write (‘nilai data ke’,i,’:’);readln(x[i]);

total := total + x[i]

end;

rata := total/n;

writeln;

writeln(‘jumlah data:’,n);

writeln(‘total nilai data:’,total:8:2);

writeln(‘rata-rata nilai data:’,rata:6:2);

readln;

end.

25 Mei 2010 - Posted by | Uncategorized

Belum ada komentar.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: