Program Perkalian Matriks

Share On :
Setelah sebelumnya kita mempelajari operasi penjumlahan dan pengurangan matriks, sekarang kita akan mencoba membuat program perkalian matriks. Tentunya perkalian matriks tidak seperti perkalian bilangan biasa. Hal ini membuat syntax program perkalian matriks tidak sesimpel syntax program penjumlahan dan pengurangan matriks.

Seperti apa program perkalian matriks? Inilah hasilnya :
program matrik_perkalian;
uses wincrt;
var a,b,c: array[1..10,1..10] of integer;
i,j,k1,k2,b1,b2,sum,r:integer;

begin
write('Masukkan baris Matrik A = ');readln(b1);
write('Masukkan kolom Matrik A = ');readln(k1);
write('Masukkan baris Matrik B = ');readln(b2);
write('Masukkan kolom Matrik B = ');readln(k2);
writeln;

writeln('Masukkan nilai matriks A!');
for i:=1 to b1 do
for j:=1 to k1 do
readln(a[i,j]);
writeln;

writeln('Masukkan nilai matriks B!');
for i:=1 to b2 do
for j:=1 to k2 do
readln(b[i,j]);
writeln;

writeln('Matrik A');
writeln('==================');
for i:=1 to b1 do
begin
for j:=1 to k1 do
write(a[i,j],' ');
writeln;
end;

writeln;
writeln('Matrik B');
writeln('===================');
for i:=1 to b2 do
begin
for j:=1 to k2 do
write(b[i,j],' ');
writeln;
end;
writeln;

writeln('Matrik A*B');
writeln('================');
for i:=1 to b1 do
begin
for j:=1 to k2 do
begin
sum:=0;
for r:=1 to k1 do
sum:=sum+a[i,r]*b[r,j];
c[i,j]:=sum;
write(c[i,j]:2,' ');
end;
writeln;
end;
end.



Hasil Programnya :

 

0 komentar:

Post a Comment

  • Mahasiswa STMIK Duta Bangsa
  • description
  • description
  • description
  • description
  • description
  • description
  • description

Free Hosting

Free Hosting

My Blog List

A
B
C
     
D
E
F
DuGMp3    
G
H
I
Goo Otomotif HouseofScript  
J
K
L
Java Hotline    
M
N
O

My Games Collection

MeLangKah LeBih MaJu

   
P
Q
R
Pamella Decoration    
S
T
U
Studied WaLL    
V
W
X
     
Y
Z
0-9
     









Join....!


Free Domain

Free Domain

SiNyO. Powered by Blogger.