|
zadach139.BAS |
|
{* Задача139 *}REM basic ' Первую половину элементов главной диагонали квадратной матрицы по возрастанию, вторую по убываниюCLS
RANDOMIZE TIMER
INPUT "vvedite n"; n
Dim a(n, n), b(n)
For i = 1 To n: For j = 1 To n
a(i, j) = FIX(RND * 100)
Next: Next
For i = 1 To n: For j = 1 To n
PRINT a(i, j);
Next: PRINT: Next
PRINT String$(80, 196)
For i = 1 To n
b(i) = a(i, i)
Next
For i = 1 To n
PRINT b(i);
Next
For i = 1 To n 2: For j = 2 To n 2
If b(j) < b(j - 1) Then SWAP b(j), b(j - 1)
Next: Next
For i = n 2 + 1 To n: For j = n 2 + 2 To n
If b(j) > b(j - 1) Then SWAP b(j), b(j - 1)
Next: Next
PRINT String$(80, 196)
For i = 1 To n
PRINT b(i);
Next
End
|