n = 30;
fprev = 0;
fcurr = 1;

while fcurr <= n
    fprintf('%d ', fcurr);
    temp = fcurr;
    fcurr = fcurr + fprev;
    fprev = temp;
end
fprintf('\n');
