В матрице К на L найти сумму элементов, максимальные и минимальные элементы. Построить вектор из элементов М строки — Basic(Бейсик)

CLS
INPUT " vv kol-vo strok ", k
INPUT "vv kol-vo stolbcov ", l
INPUT "N stroki ", M
 
DIM a(k, l)
RANDOMIZE TIMER
FOR i = 1 TO k
FOR j = 1 TO l
a(i, j) = INT(RND(1) * 10) - 5
PRINT a(i, j); " ";
NEXT
PRINT
NEXT
PRINT
 
 
minimum = a(1, 1)
maximum = a(1, 1)
sum = 0
 
FOR i = 1 TO k
FOR j = 1 TO l
sum = sum + a(i, j)
IF a(i, j) > maximum THEN maximum = a(i, j)
IF a(i, j) < minimum THEN minimum = a(i, j)
NEXT j
NEXT i
 
DIM b(l)
FOR i = 1 TO l
b(i) = a(M, i)
NEXT i
 
PRINT "summa="; sum
PRINT "max="; maximum
PRINT "min="; minimum
PRINT "vektor iz stroki m "
 
FOR i = 1 TO l
PRINT b(i); " ";
NEXT

Leave a Comment