|
zadach89.BAS |
|
{* Задача89 *}REM basic ' Отсортировать столбцы массива A(N, M) из случайных чисел от 10 до 50 по убыванию элементов.CLS : INPUT "Vvedite M(stolbc): ", M
INPUT "Vvedite N(stroki): ", N
Dim A(M, N) As Integer
RANDOMIZE TIMER
For iy = 1 To N
For ix = 1 To M
A(ix, iy) = RND * 40 + 10
PRINT A(ix, iy);
Next: PRINT
Next
For ix = 1 To M
For j = N - 1 To 1 Step -1
For iy = 1 To j
If A(ix, iy) < A(ix, iy + 1) Then SWAP A(ix, iy), A(ix, iy + 1)
Next iy, j
Next
PRINT "Novaya matrica: "
For iy = 1 To N
For ix = 1 To M
PRINT A(ix, iy);
Next: PRINT
Next
End
|