В матрице a(6, 8) найти произведение элементов каждого столбца и расположить эти произведения в порядке возрастания — QBasic(Бейсик)

СLS
DIM a(6, 8) AS INTEGER
DIM p(8) AS SINGLE
DIM i AS INTEGER
DIM j AS INTEGER
RANDOMIZE TIMER
PRINT "Matrica"
FOR i = 1 TO 6
 FOR j = 1 TO 8
  a(i, j) = INT(RND * 250) - 60
  PRINT a(i, j);
 NEXT j
 PRINT
NEXT i
FOR j = 1 TO 8
 p(j) = 1
 FOR i = 1 TO 6
  p(j) = p(j) * a(i, j)
 NEXT i
NEXT j
PRINT
PRINT "Proizvedeniya stolbcov"
FOR j = 1 TO 8
 PRINT p(j);
NEXT j
PRINT
FOR j = 1 TO 7
 FOR i = j + 1 TO 8
  IF p(i) < p(j) THEN SWAP p(i), p(j)
 NEXT i
NEXT j
PRINT
PRINT "Proizvedenia stolbcov v poryadke vozrastania"
FOR i = 1 TO 8
 PRINT p(i);
NEXT i

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

Leave a Comment