Sunday, 28 October 2012

Matriks identitas modifikasi (PASCAL)

program Matrik_identitas_modifikasi;
uses crt;
var

  i,j,k,l : integer;
  pil :char;

begin
 repeat
 begin
 clrscr;
 writeln('Program Matriks_Identitas_Modifikasi');
 writeln('====================================');
 write('Masukan ordo matrik  = ' ); readln(i);
     k := i;
       if (k>0)and (k<=1000) then
       begin
            for j:=1 to i do
            begin
             for l:=1 to i do
             begin
             if (j=l) then
             write(j)
             else
             write('0');
             end;
             writeln();
            end;
       end
       else
       writeln('inputan ',i,' tidak di perbolehkan');
       writeln;
     end;
   writeln;
   write (' Apakah anda ingin mengisi kembali ?(Y/T) = ');readln(pil);
   until pil = 't';

end.

Tampilan :


No comments:

Post a Comment