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,

0 0
Add a comment Improve this question Transcribed image text
Answer #1

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)

Add a comment
Know the answer?
Add Answer to:
Create a function, myProd(), that takes two arguments, x and y, and multiplies the two arguments...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT