Читайте также:
|
|
CLS
INPUT n, m
DIM A(n, m), B(n)
FOR i = 1 TO n
FOR j = 1 TO m
INPUT A(i, j)
NEXT j, i
INPUT A, B
FOR i = 1 TO n
K = 0
FOR j = 1 TO m
IF A(i, j) >= A AND A(i, j) <= B THEN K = K + 1
NEXT j
B(i) = K
NEXT i
FOR i = 1 TO n
PRINT B(i);
NEXT i
END
Задача 7 (стр.43)
CLS
INPUT n, m
DIM A(n, m)
FOR i = 1 TO n
FOR j = 1 TO m
INPUT A(i, j)
NEXT j, i
INPUT A
FOR i = 1 TO n
K = 0
FOR j = 1 TO m
IF A(i, j) MOD 10 = A THEN K = K + 1
NEXT j
IF K <> 0 THEN
PRINT "В строке"; i; "имеются, их количество="; K
ELSE
PRINT "В строке"; i; "нет таких чисел"
END IF
NEXT i
END
Задача 10 (стр.43)
CLS
INPUT n, m
DIM A(n, m) AS INTEGER
FOR i = 1 TO n
FOR j = 1 TO m
INPUT A(i, j)
NEXT j, i
FOR i = 1 TO n
K = 0
FOR j = 1 TO m
IF A(i, j) > 0 THEN K = K + 1
NEXT j
IF K = m THEN PRINT i: EXIT FOR
NEXT i
END
Задача 3 (стр.49)
CLS
INPUT n, m
DIM A(n, m), B(m)
FOR i = 1 TO n
FOR j = 1 TO m
INPUT A(i, j)
NEXT j, i
FOR j = 1 TO m
MAX = A(1, j)
FOR i = 1 TO n
IF A(i, j) > MAX THEN MAX = A(i, j)
NEXT i
B(j) = MAX - A(1, j)
NEXT j
FOR j = 1 TO m
PRINT B(j);
NEXT j
END
Задача 4 (стр.53)
CLS
INPUT n, m
DIM A(n, m)
FOR i = 1 TO n
FOR j = 1 TO m
INPUT A(i, j)
NEXT j, i
FOR j = 1 TO m
FOR i = 1 TO n
IF A(i, j) < 0 THEN K1 = i: EXIT FOR
NEXT i
FOR i = 1 TO n
IF A(i, j) = 0 THEN k2 = i: EXIT FOR
NEXT i
SWAP A(K1, j), A(k2, j)
NEXT j
FOR i = 1 TO n
FOR j = 1 TO m
PRINT A(i, j);
NEXT j
NEXT i
END
Задача 9 (стр.54)
CLS
INPUT n, m
DIM A(n, m), B(n)
FOR i = 1 TO n
FOR j = 1 TO m
INPUT A(i, j)
NEXT j, i
FOR i = 1 TO n
FOR j = 1 TO m
IF A(i, j) MOD 3 = 0 THEN K = A(i, j): EXIT FOR
NEXT j
B(i) = K
NEXT i
max = B(1)
L = 1
FOR i = 2 TO n
IF B(i) > max THEN max = B(i): L = i
NEXT i
PRINT "max="; max, "L="; L
END
Дата добавления: 2015-07-11; просмотров: 45 | Нарушение авторских прав