Question
If someone could explain and help me fix the part that show as
ans = 16
I dont get why that shows up and i have check the program already
19 grade = input (Error! Enter a valid grade: ); end fprintf(The valid grade enteres is: $1f\n, grade) $ Question 3 El fu
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Note: Please put ; after function call to avoid getting ans = 16;

=================== modified matlab code =========================

%%%%% question 3%%%%%%%%%%
function [arovo] = rectareavol(length,width,height)
if nargin == 2
A = length * width;
arovo = fprintf('The area is [%d]\n',A);
else
A = length * width;
V = length * width * height;
arovo = fprintf('The Area is [%d] and the Volume is [%d]\n',A,V);
end
end

------------------------------------------------------------------------------------------------------------------------

Screenshots of the code and the output:

--------------------------------------------------------------------------------------------------------------------------

| | %%%%% question 3%%%%%%%%%% function [arovo] = rectareavol (length,width, height) if nargin == 2 A = length + width; arovo

>> [arovo] = rectareavol (2,2); The area is [4]

====================== end ===========================================

PLEASE LIKE THE POST   

Add a comment
Know the answer?
Add Answer to:
If someone could explain and help me fix the part that show as ans = 16...
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