Построить наддиогональную квадратную матрецу Dx*x
Категория: Delphi/Pascal
2011-12-29 22:21:27
.....|a1 a2 a3 a4 ... an |
.....|0 a1 a2 a3 ... an-1 |
D= |0 0 a1 a2 ... an-2 |
.....|... ... ... ... ... ... |
.....|0 0 0 0 ... a1 |
code: #pascal
var mas1 : array [1..5,1..5] of integer; mas2 : array [1..5] of integer; x, y, a : Byte; begin For x := 1 to 5 do Readln(mas2[x]); For x := 1 to 5 do Write(mas2[x],' '); a := 0; For x := 1 to 5 do Begin For y := 1 + a to 5 do mas1[x,y] := mas2[y - a]; a := a + 1; End; Writeln; Writeln; For x := 1 to 5 do Begin For y := 1 to 5 do Write(mas1[x,y],' '); Writeln; End; Readln; end.
автор: Карась
Поделиться: