Ticker

6/recent/ticker-posts

Mencari Invers dan Determinan pada Pascal

program matriks;
uses wincrt;
var a,b,c,d,i,invers,p,q,r,s:real;

begin
writeln('Mencari Invers Matriks Ordo 2x2 ');
gotoxy(5,5);write('a=');read(a);
gotoxy(18,5);write('b=');read(b);
gotoxy(5,7);write('c=');read(c);
gotoxy(18,7);write('d=');read(d);
D := a*d - b*c;
writeln('Det(A) = ',D);
i:=(a*d)-(b*c);
if not(i=0) then
begin
invers:=1/((a*d)-(b*c));
p:=d*invers;
q:=-b*invers;
r:=-c*invers;
s:=a*invers;
gotoxy(5,10);writeln('Invers matriks A =');
gotoxy(5,13);write(p:0:3);
gotoxy(18,13);write(q:0:3);
gotoxy(5,16);write(r:0:3);
gotoxy(18,16);write(s:0:3);
end
else
begin
gotoxy(25,15);
writeln('Tidak ada invers matriks');
end;
end.

semoga bermanfaat.

Posting Komentar

0 Komentar