hw8_problem4

hw8_problem4 - How is it fixed Add a second end statement...

This preview shows page 1. Sign up to view the full content.

a = 7; if a=1 disp('There is only one apple') elseif a<=3 disp('There are at most three apples') elseif a==2 disp('There are only two apples') else a>=4 disp('There are at least four apples') end % ---- Output section ---- % Line No.: 3 % What is Error: Only 1 = sign in logical expression % How is it fixed: Add second equal sign (a==1) % Line No.: 5 % What is Error: Space between else and if without a second end statement % How is it fixed: Remove the space between the else and if (elseif) % Line No.: 5 % What is Error: Space between else and if without a second end statement
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % How is it fixed: Add a second end statement in line 14 (create nested if) % Line No.: 5 % What is Error: logical statement is incorrect (=<) % How is it fixed: The expression should be <= (a<=3) % Line No.: 9 % What is Error: logical expression after the else statement % How is it fixed: delete the logical expression % Line No.: 7/8 % What is Error: error in order of the logic - line 8 will never be displayed % How is it fixed: move lines 7/8 before line 5...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online