Создать матрицу — Pascal(Паскаль)

 Выдает матрицу видом

1 1 1 1 1
0 1 1 1 1
0 0 1 1 1
0 0 0 1 1
0 0 0 0 1

Program Laba4;
uses crt;
Var matrix : array[1..25,1..25] of byte;
   n,i,j,k : byte;

begin
  clrscr;
  write('enter n = '); readln(n);

  for i:= 1 to n do
         for j:= 1 to n do
             if i < j then matrix[i,j] := 0 else matrix[i,j] := 1;

  for j:= 1 to n do
  begin
       for i:= 1 to n do
       write(matrix[i,j]:3);
       writeln;
  end;
repeat until keypressed;
end.

Leave a Comment

26 − 17 =