From 366c3f864265759ba5a8f2bc9ed9fa8ae54f17ff Mon Sep 17 00:00:00 2001 From: KAUSHAL DEVRARI <71590645+KaushalDevrari@users.noreply.github.com> Date: Fri, 2 Oct 2020 01:10:07 +0530 Subject: [PATCH] Create calc.m --- algorithms/maths/calc.m | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 algorithms/maths/calc.m 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