CLS
n = 10
DIM a(n), c(n)
RANDOMIZE TIMER
FOR i = 1 TO n
a(i) = INT(RND * 101) - 50
NEXT
FOR i = 1 TO n
c(i) = INT(RND * 101) - 50
NEXT
PRINT "Massiv a(10)"
FOR i = 1 TO n
PRINT a(i);
NEXT
PRINT: PRINT
PRINT "Massiv c(10)"
FOR i = 1 TO n
PRINT c(i);
NEXT
PRINT: PRINT
INPUT "Vvedite chislo P="; p
PRINT
k = 0
FOR i = 1 TO n
IF a(i) < p THEN k = k + 1
IF c(i) < p THEN k = k + 1
NEXT i
IF k > 0 THEN
DIM d(k)
k = 0
FOR i = 1 TO n
IF a(i) < p THEN k = k + 1: d(k) = a(i)
IF c(i) < p THEN k = k + 1: d(k) = c(i)
NEXT i
PRINT "Ryad d"; "("; k; ")"
FOR i = 1 TO k
PRINT d(i);
NEXT i
ELSE
PRINT "Vse elementi massiva a(10) i b(10)>"; p
END IF
Тестирование выполнено в программе QB64 ( Скачать )