question 6 ece

 avatar
unknown
plain_text
3 years ago
441 B
4
Indexable
function result = basic_calc(x, y, operation)
switch operation
    case "addition"
        result = x+y;
    case "subtraction"
        result = x-y;
    case "multiplication"
        result = x*y;
    case "division"
        result = x/y;
    case "exponentiation"
        result = x^y;
    otherwise 
        disp("given operation cannot be found. try again with addition, subtraction, multiplication, division or exponentiation.")
end
end
Editor is loading...