|
zadach141.BAS |
|
{* Задача141 *}REM basic ' Дана матрица N*M. Переставить местами строки с четными и нечетными номерами.CLS
RANDOMIZE TIMER
INPUT "vvedite n"; n
INPUT "vvedite m"; m
Dim a(n, m), b(n)
For i = 1 To n: For j = 1 To m
a(i, j) = FIX(RND * 100)
c(i) = a(i, 1)
Next: Next
For i = 1 To n: For j = 1 To m
PRINT a(i, j);
Next: PRINT: Next
PRINT String$(80, 196)
For i = 1 To n: For j = 1 To m
If (i And 1) = 0 Then SWAP a(i, j), a(i - 1, j)
Next: Next
For i = 1 To n: For j = 1 To m
PRINT a(i, j);
Next: PRINT: Next
PRINT String$(80, 196)
For i = 1 To n: For j = 1 To m
If a(i, j) > c(i) Then c(i) = a(i, j)
Next: Next
For i = 1 To n
PRINT c(i);
Next
End
|