Program matriks determinan dan invers

Program det_matriks;
uses wincrt;
var a,b,c: array[1..5,1..5] of integer;
i,j,b1,k1,det:integer;
begin
write('Masukkan baris matriks A = ');readln (b1);
write('Masukkan kolom matriks A = ');readln (k1);
for i:=1 to b1 do
for j:=1 to k1 do
readln(a[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('determinan matriks A = ');
writeln('================');
begin
det:=(a[1,1]*a[2,2])-(a[1,2]*a[2,1]);
write('det A = ',det);
end;
writeln;
writeln;
writeln ('adjoin matriks A');
writeln ('================');
for i:=1 to b1 do
begin
for j:=1 to k1 do
begin
b[1,1]:= a[2,2];
b[1,2]:=-1*a[1,2];
b[2,1]:=-1*a[2,1];
b[2,2]:= a[1,1];
write (b[i,j]:3,' ');
end;
writeln;
end;
writeln;
writeln ('invers matriks A');
writeln ('================');
for i:=1 to b1 do
begin
for j:=1 to k1 do
write(b[i,j]/det:7:2,' ');
writeln;
end;
end.

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 komentar:

Posting Komentar