Write a local function named MaxValue that returns the maxim
Write a local function named MaxValue that returns the maximum of two inputs numA and numB. Your Solution Do not modify CalculateSum function maxSum = CalculateSum(userNuml, userNum2, userNum3) maxSum = MaxValue(userNuml, userNum2) + userNum3; end % Define a function MaxValue that returns the largest input value % Function inputs: numA, numB n % Function output: maxNum % function maxNum ... Code to call your function when you click CalculateSum(4, 7, 3)
Solution
create a file named MaxValue.m and place the below code.
function max = MaxValue(numA,numB)
% returns the maximum value
if(numA>numB)
max = numA;
else
max = numB;
end
end
