Create a function, myProd(), that takes two arguments, x and y, and multiplies t
ID: 3585016 • Letter: C
Question
Create a function, myProd(), that takes two arguments, x and y, and multiplies the two arguments together then adds 14 to the result. Finally, divide the sum by two and return as z
I cannot come up with a solution for the above question, Could I get an explanation on how to approach and solve this problem.
Thank you,
I) Create a function, myProd), that takes two arguments, r and y, and multiplies the twoarguments together then adds 14 to the result. Finally, divide the sum by two and return as . Include help in your function.Explanation / Answer
myProd2.m
function z = myProd2(x,y)
global result;
result=(x*y); %instead of these 3 line we can do in a single line program like
result=result+14; % z=((x*y)+14)/;
result=result/2; %
z=result; %whatever the variable which we want to return,that variable has to be
%defined beside the function like ex:function 'z'
end
main.m
myProd2(3,4)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.