Rewrite the following if statement as an equivalent switch statement. The variable num is of type int.

```
if (num == 0 || num == 1)
control = 100;
else if (num == 2)
control = 200;
else if (num == 3)
control = 300;
else
control = 0;
```


```
switch (num) {
case 0:
case 1:
control = 100;
break;
case 2:
control = 200;
break;
case 3:
control = 300;
break;
default:
control = 0;
}
```

Computer Science & Information Technology

You might also like to view...

What is the order of the following growth functions?

a. 10n2 + 100n + 1000 b. 10n3 – 7 c. 2n + 100n3 d. n2 log n

Computer Science & Information Technology

Which connector would be an alternative to a mini-DIN keyboard port?

A) DVI B) RJ-45 C) USB D) S/PDIF

Computer Science & Information Technology

What should the developer do if there is a lot of unanswered questions during your analysis?

A. Code the application with what is known and work out the kinks later B. Push the requirements back to the BAs C. Code what you can and fill in the blanks later D. Code now and weed out issues in testing

Computer Science & Information Technology

What type of ransomware displays a screen and prevents the user from accessing the computer's resources?

A. crypto-malware B. standard ransomware C. blocker ransomware D. locking-malware

Computer Science & Information Technology