Program Matrik Dengan Pascal

program matrik;
uses wincrt;
type data = array[1..5,1..5] of integer;
var
matrikI,matrikII : data;
baris,kolom,pil : integer;

procedure isi;
var i,j :integer;
begin
writeln(‘Penentuan ORDO MATRIK I’);
write(‘Masukan banyak baris matrik I : ‘);readln(baris);
write(‘Masukan banyak kolom matrik I : ‘);readln(kolom);
for i:=1 to baris do
for j:=1 to kolom do
begin gotoxy(j*10,i*5);
readln(matrikI[i,j]);
end;
clrscr;
writeln(‘Penentuan ORDO MATRIK II’);
write(‘Masukan banyak baris matrik II : ‘);
readln(baris);
write(‘Masukan banyak kolom matrik II : ‘);
readln(kolom);
for i:=1 to baris do
for j:=1 to kolom do
begin gotoxy(j*10,i*5);
readln(matrikII[i,j]);
end;
end;

procedure jumlah(a1,a2 : data);
var
hasil:data;
i,j:integer;
begin
for i:=1 to baris do
for j:=1 to kolom do
begin
hasil[i,j]:=a1[i,j]+a2[i,j];
end;
clrscr;
writeln(‘Hasil Penjumlahan’);
for i:=1 to baris do
for j:=1 to kolom do
begin gotoxy(j*10,i*5);
write(hasil[i,j]);
end;
end;

procedure kurang(a1,a2 : data);
var
hasil: data;
i,j: integer;
begin
for i:=1 to baris do
for j:=1 to kolom do
begin
hasil[i,j]:=a1[i,j]-a2[i,j];
end;
clrscr;
writeln(‘Hasil Pengurangan’);
for i:=1 to baris do
for j:=1 to kolom do
begin gotoxy(j*10,i*5);
write(hasil[i,j]);
end;
end;

procedure kali(a1,a2 : data);
var
hasil:data;
i,j,z:integer;
begin
for i:=1 to baris do
for j:=1 to kolom do
begin
hasil[i,j]:=0;
for z:=1 to baris do
hasil[i,j]:=hasil[i,j]+matrikI[i,z]*matrikII[z,j];
end;
clrscr;
writeln(‘Hasil perkalian’);
for i:=1 to baris do
for j:=1 to kolom do
begin gotoxy(j*10,i*5);
write(hasil[i,j]);
end;
end;
begin
writeln(‘MENU’);
writeln(‘(1) Penjumlahan Matrik’);
writeln(‘(2) Pengurangan Matrik’);
writeln(‘(3) Perkalian Matrik’);
write(‘Pilihan = ‘);
readln(pil);
clrscr;
case pil of
1 :begin
isi;
jumlah(matrikI,matrikII);
end;
2:begin
isi;
kurang(matrikI,matrikII);
end;
3:begin
isi;
kali(matrikI,matrikII);
end;
end;

end.

2 Tanggapan to “Program Matrik Dengan Pascal”

  1. yaampun panjang beud😦

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: