diff --git a/algorithms/maths/calc.m b/algorithms/maths/calc.m new file mode 100644 index 0000000..24321e1 --- /dev/null +++ b/algorithms/maths/calc.m @@ -0,0 +1,18 @@ +%This function acts as a calculator +%It takes the input 1: add 2:subtract 3: multiply 4: divide + + function [a]=calc(x,y,z) + if z==1 + a=x+y; + elseif z==2 + + a=x-y; + elseif z==3 + + + a=x*y + else + + a=x/y; + + end