DIM n AS INTEGER
DIM k AS INTEGER
DIM i AS INTEGER
n = 10
DIM a(n) AS INTEGER
RANDOMIZE TIMER
PRINT "Ishodniy Massiv"
FOR i = 1 TO n
a(i) = ABS(INT(RND * 101) - 50)
PRINT a(i);
NEXT i
PRINT
' Yesli samii pravii element - chetnii, togda zadacha ne reshaema
k = a(n)
IF (k MOD 2) = 0 THEN
PRINT "Zadacha ne reshayema"
END
END IF
FOR i = n - 1 TO 1 STEP -1
IF (a(i) MOD 2) = 0 THEN a(i) = k ELSE k = a(i)
NEXT i
PRINT "Massiv posle preobrazovaniy"
FOR i = 1 TO n
PRINT a(i);
NEXT i
Тестирование выполнено в программе QB64 ( Скачать )