% This file demonstrates piece-wise function evaluation using
% a separate if-blocks

x = input('input x: ');
y = input('input y: ');

if(x >= 0 && y >= 0)
    fx = x + y;
end

if (x >= 0 && y < 0)
    fx = x + y*y;
end

if (x < 0 && y >= 0)
    fx = x*x + y;
end

if (x < 0 && y < 0)
    fx = x*x + y*y;
end


fprintf('Result: %f\n',fx);
       