% This file demonstrates piece-wise function evaluation using
% a single if-statement block

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

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

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