Question

Create a conditional statement (ex: x=3; y=5; z=x>y). If the conditional statement equals 0, display ‘false’,...

Create a conditional statement (ex: x=3; y=5; z=x>y). If the conditional statement equals 0, display ‘false’, and if it equals 1, display ‘true’. Use a switch-case to make the decision. Change the conditional statement so that both ‘true’ and ‘false’ are tested.

USING MATLAB

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

x=3;
y=5;
z=x>y;
switch z
case {0}
fprintf("false");
case {1}
fprintf("true");
otherwise
fprintf('\nYou have given a wrong input\n')
end

=======================================================
SEE OUTPUT

1 X=3; 2 y=5; 3 Z=x>y; 4 switch z 5 case {0} 6 fprintf(false); 7 case {1} 8 fprintf(true); 9 otherwise 10 fprintf(\nYou


========================================
Thanks, let me now if there is any concern.

Add a comment
Know the answer?
Add Answer to:
Create a conditional statement (ex: x=3; y=5; z=x>y). If the conditional statement equals 0, display ‘false’,...
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