Question: Conditionals Part 2 Let's do another cenditional using this nested if - end structure. There is one short segments of code in the Leamer Template

Conditionals Part 2
Let's do another cenditional using this "nested if-end" structure. There is one short segments of code in the Leamer Template to set up nums_vec as a random row vector.
Write a nested if end statement based off this criteria:
Evaluate if the first element of nums_vec is greater than 4.
If it is, then check if first element of nums_vec is less than 10.
If it is greater than 4, and less than 10(satisfying both the conditions above), subtract 4 from the first element of nums_vec, saving this new value to that first element of
nums_vec.
Then, set a variable called is_one_or_ten to 0
Now, write a switch case based off this criteria:
In the case that the first element of nums_vec is 1, set is_one_or_ten to 1
In the case that the first element of nums_vec is 10, set is_one_or_ten to 2
Note:
Don't change anything in the first 2 lines.
Conditionals Part 2 Let's do another cenditional

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!