Sabtu, 29 November 2014

Program isi matrik ALGORITMA



LISTING PROGRAM

program Isi_matriks;
uses wincrt;
var
   MatA : array[1..100,1..100] of integer;
   I,j : integer;
   bar, kol : integer;
   max, min : integer;
begin
 clrscr;
   write('banyak baris = '); readln(bar);
   write('banyak kolom = '); readln(kol);
   writeln;
   for i:=1 to bar do
   begin
        for j:=1 to kol do
        begin
             write('MatA [',I,',',j,'] = ');
             readln(MatA[I,j]);
        end;
   end;
   writeln;
   write('isi MatA = ');
   for i:=1 to bar do
   begin
        for j:=1 to kol do
            write(MatA[I,j]:3);
            writeln;
   end;
   max:=MatA[1,1];
   min:=MatA[1,1];
   for i:=1 to bar do
   begin
        for j:=1 to kol do
        if MatA[I,j]>max then
        max:= MatA[I,j]
        else
        if MatA[I,j]<min then
        min:=MatA[I,j];

   end;
   writeln('elemen terbesar = ',max);
   writeln('elemen terkecil = ',min);
   readln;

end.



  hasil RUN
 


0 komentar:

Posting Komentar

 
Copyright © . Suka-Suka Gendux - Posts · Comments
Theme Template by BTDesigner · Powered by Blogger