function e = calculator() op=input("Enter operator ",'s'); x=input("Enter num1 "); y=input("Enter num2 "); switch(op) case "+" e=x+y; case "-" e=x-y; case "*" e=x*y; case "/" e=x/y; otherwise disp("Invalid!") end
function e = calculator() op=input("Enter operator ",'s'); x=input("Enter num1 "); y=input("Enter num2 "); switch(op) case "+" e=x+y; case "-" e=x-y; case "*" e=x*y; case "/" e=x/y; otherwise disp("Invalid!") end