RANDOMIZE TIMER
CLS
N = 5
DIM A(N, N), B(N)
PRINT "MATRICA: "
FOR I = 1 TO N
FOR J = 1 TO N
A(I, J) = INT(RND * 10 - 4)
PRINT A(I, J);
NEXT
PRINT
NEXT
PRINT
PRINT "VECTOR: "
FOR I = 1 TO N
B(I) = A(I, I)
PRINT B(I);
NEXT
PRINT
PRINT
FOR J = 1 TO N
A(1, J) = B(J)
NEXT
PRINT "RESULT MATRICA: "
FOR I = 1 TO N
FOR J = 1 TO N
PRINT A(I, J);
NEXT
PRINT
NEXT
Тестирование выполнено в программе QB64 ( Скачать )