Транспортировать матрицу х (10,10) — QBasic(Бейсик)

DIM a(10, 10)
RANDOMIZE TIMER
PRINT "ishodnaya matrica"
FOR i = 1 TO 10
    FOR j = 1 TO 10
        a(i, j) = INT(RND * 10)
        PRINT a(i, j);
    NEXT
    PRINT
NEXT
FOR i = 1 TO 10
    FOR j = 1 TO i
        SWAP a(i, j), a(j, i)
    NEXT
NEXT
PRINT "novaya matrica"
FOR i = 1 TO 10
    FOR j = 1 TO 10
        PRINT a(i, j);
    NEXT
    PRINT
NEXT

Тестирование выполнено в программе QB64 ( Скачать )

Leave a Comment