PENJUMLAHAN & PERKALIAN MATRIK DENGAN PASCAL

Written By Abdul Wakhid on 9 November 2009 | 17.13.00


abdulmail -
Program MATRIK_by_Abdulmail;
uses crt;
var
A,B,C,D:array [1..3,1..3] of integer;
p,u,i,j,x,y: integer; {faktor pengulang}
pil : char;
label awal,akhir,salah;
begin
awal:clrscr;
begin
clrscr;
gotoxy(5,2);writeln('PROGARAM PENJUMLAHAN & PERKALIAN DUA MATRIK ORDO TIGA');
gotoxy(5,3);writeln('=====================================================');
gotoxy(6,5);write('MASUKKAN NILAI MATRIK A & B ');
gotoxy(4,10);writeln('A :');
for i:=1 to 3 do
begin
for j:=1 to 3 do
begin
gotoxy(3*i+5,2*j+6);
read(A[i,j]);
end;readln;end;end;
begin
gotoxy(24,10);writeln('B :');
for i:=1 to 3 do
begin
for j:=1 to 3 do
begin
gotoxy(3*i+25,2*j+6);
read(B[i,j]);
end;readln;end;end;
clrscr;
gotoxy(11,4); writeln('Menampilkan Matrik A dan Matrik B');
begin
gotoxy(10,10);writeln('A :');
for i:=1 to 3 do
begin
for j:=1 to 3 do
begin
gotoxy(3*i+12,2*j+6);
write(A[i,j]);
end;end;end;
begin
gotoxy(25,10);writeln('B :');
for i:=1 to 3 do
begin
for j:=1 to 3 do
begin
gotoxy(3*i+27,2*j+6);
write(B[i,j]);
end;end;end;readln;
begin
Begin
clrscr;
gotoxy(10,5);writeln('HASIL DARI PENJUMLAHAN & PERKALIAN MATRIKNYA');
gotoxy(13,10);writeln('A + B = ');
end;
begin
for i:=1 to 3 do
begin
for j:=1 to 3 do
begin
gotoxy(3*i+20,2*j+6);
C[i,j]:=A[i,j]+B[i,j];
write(C[i,j]:3);
end;
end;
Begin
gotoxy(13,19); writeln('A * B = ');
writeln;
for i:=1 to 3 do
begin
for j:=1 to 3 do
begin
gotoxy(3*i+20,2*j+15);
x:=0;
for y:=1 to 3 do
x:=x + A[y,j] * B[i,y];
D[i,j]:=x;
write(D[i,j]:3);
end;end;end;end;end;
salah:begin
writeln;writeln;writeln;writeln;
write(' INGIN MENGULANG LAGI ?(Y/N)');readln(pil);
if (pil='y') or (pil='Y') then goto awal;
if (pil='n') or (pil='N') then goto akhir
else writeln(' PILIHAN HANYA Y / N ');goto salah;
akhir:end;
end.


ni program penjumlahan matrik dan perkalian matrik dengan pascal. Mohon dikoreksi jika salah..!


by : Abdulmail

1 komentar:

Anonim mengatakan...

he...he... mumet2, mumet2., tulisan pa wi., mumet, hix...hix...

Posting Komentar

Don't Spam Please !