close all; clear; clc

array = [1 2 5 8 7 -3 10 9];

for i = 1:length(array)
    x = array(i);
    if x < 0
        break
    elseif mod(x, 2) == 0
        continue
    end
    x = x^2;
    array(i) = x;
end

disp(array)