uses crt;
var baris, kolom, i, j, c : integer;
x : array[1..100,1..100] of integer;
begin
clrscr;
write ('masukkan baris matriks : '); readln (baris);
write ('masukkan kolom matriks : '); readln (kolom);
writeln ('matriks anda berordo ',baris,' X ',kolom);
for i := 1 to baris do
for j := 1 to kolom do
begin
write ('nilai [',i,',',j,'] : '); readln (x[i,j]);
end;
writeln;
writeln ('matriksnya : ');
for i := 1 to baris do
begin
for j := 1 to kolom do
write (x[i,j]:3); writeln ;
end;
for i := 1 to baris do
for j := i to i do
begin
if x[i,j]=1 then c := c+1
else c := c+0;
end;
if c=baris then
writeln ('matriks identitas')
else
begin
for i := 1 to baris
do
begin
for j := 1 to
kolom do
begin
if (i=j) and
(x[i,j] <> 1) then
begin
x[i,j]:=1 ;
end;
end;
end;
Tidak ada komentar:
Posting Komentar