MATLAB nested if-else

  • If statements can be nested, but each if statement requires the end keyword.

Syntax:

Example1

Output:

enter a number greater than 1 and less than 10: 9
a = 9
the random number is: 14
the random number is not divisible by the entered number

Example 2:


Next Topic#




Latest Courses