Program Determinante;
Uses CRT;
Var
M: Array [0..4,0..4] OF Integer;
Li, Co, Det, A11, A12, A13, A14: Integer;
Begin
ClrScr;
Writeln('Informe os termos da Matriz (4x4): ');
For Li := 0 to 3 Do
For Co := 0 to 3 Do
Begin
M[Li,Co] := 0;
Writeln('Linha = ' , Li , ' Coluna = ' , Co);
Readln(M[Li,Co]);
End;
ClrScr;
A11 := M[0,0]*( (M[1,1]*M[2,2]*M[3,3]) + (M[1,2]*M[2,3]*M[3,1]) +
(M[1,3]*M[2,1]*M[3,2]) - (M[1,3]*M[2,2]*M[3,1]) -
(M[1,1]*M[2,3]*M[3,2]) - (M[1,2]*M[2,1]*M[3,3]) );
A12 := M[0,1]*( (M[1,0]*M[2,2]*M[3,3]) + (M[1,2]*M[2,3]*M[3,0]) +
(M[1,3]*M[2,0]*M[3,2]) - (M[1,3]*M[2,2]*M[3,0]) -
(M[1,0]*M[2,3]*M[3,2]) - (M[1,2]*M[2,0]*M[3,3]) )*(-1);
A13 := M[0,2]*( (M[1,0]*M[2,1]*M[3,3]) + (M[1,1]*M[2,3]*M[3,0]) +
(M[1,3]*M[2,0]*M[3,1]) - (M[1,3]*M[2,1]*M[3,0]) -
(M[1,0]*M[2,3]*M[3,1]) - (M[1,1]*M[2,0]*M[3,3]) );
A14 := M[0,3]*( (M[1,0]*M[2,1]*M[3,2]) + (M[1,1]*M[2,2]*M[3,0]) +
(M[1,2]*M[2,0]*M[3,1]) - (M[1,2]*M[2,1]*M[3,0]) -
(M[1,0]*M[2,2]*M[3,1]) - (M[1,1]*M[2,0]*M[3,2]) )*(-1);
Writeln('I11 = ', M[0,0] , ' I12 = ', M[0,1] , ' I13 = ', M[0,2] , ' I14 = ', M[0,3]);
Writeln('A11 = ', A11, ' A12 = ', A12, ' A13 = ', A13, ' A14 = ', A14);
Det := A11 + A12 + A13 + A14;
Writeln(Det);
Readkey;
End.
Good
ResponderExcluir