Minggu, 22 April 2012

Program Matriks_Simetri; ( Algoritma dan Pemograman )


Program Matriks_Simetri;
uses crt;
 type
 matriks = array [1..50,1..50] of integer;
var
a  : matriks;
x,i,j  : integer;
r  : string;
simetri : boolean;
begin
simetri := true;
clrscr;
gotoxy(25,2);writeln('Menjumlahkan Elemen Matriks');
gotoxy(25,3);writeln('---------------------------');
gotoxy(25,4);write('Jumlah Baris dan Kolom : ');readln(x);
window(25,9,51,17);textbackground(2);clrscr;
  textcolor(15);
  for i := 1 to x do
  begin
    for j := 1 to x do
      begin
        gotoxy(j*5,i+2);readln(A[i,j]);

      end;
    end;

for i := 1 to x do
 begin
  for j := 1 to x do
   begin
    if (A[i,j] <> A[j,i]) then
      begin
            simetri:=false;
      end;
         end;
   end;


      if (simetri=true)  then
      r :='simetri'
      else r :='tidak simetri';

window(22,7,55,7);textbackground(9);clrscr;
 textcolor(15);write('Matriks ini : ', r);
readln;
end.

Tidak ada komentar:

Posting Komentar