CLS
INPUT "vvedite n: ", n
DIM a(n + 1)
FOR i = 1 TO n
PRINT "vvedite a("; i; ")";
INPUT ": ", a(i)
NEXT
FOR i = 1 TO n
IF a(i) < 0 THEN a(i) = SQR(a(i - 1) + SQR(a(i + 1)))
NEXT
PRINT "Preobrazovannyj massiv:"
FOR i = 1 TO n
PRINT a(i);
NEXT
Тестирование выполнено в программе QB64 ( Скачать )