IF STATEMENTS

ELSE IF AND ELSE

if (income > 10000000)

str = ’top 0.01%’;

elseif (income > 1000000)

str = ’top 0.1%’;

elseif (income > 531000)

str = ’top 1%’;

elseif (income > 201000)

str = ’top 10%’;

else

str = ’bottom 90%’;

end

fprintf(’$%.2f is in the %s of US household incomes\n’,income,str)


SWITCH STATEMENT