Based on the dangling-else discussion in Exercise, state the output for each of the following code snippets when x is 9 and y is 11 and when x is 11 and y is 9. We eliminated the indentation from the following code to make the problem more challenging. [Hint: Apply indentation conventions you’ve learned.]
```
a) if (x < 10)
if (y > 10) Console.WriteLine("*****");
else
Console.WriteLine("#####");
Console.WriteLine("$$$$$");
b) if (x < 10)
{
if (y > 10) Console.WriteLine("*****");
}
else
{
Console.WriteLine("#####");
Console.WriteLine("$$$$$");
}
```
a) When x is 9 and y is 11
*****
$$$$$
When x is 11 and y is 9
$$$$$
b) When x is 9 and y is 11
*****
When x is 11 and y is 9
#####
$$$$$
You might also like to view...
Cell margins can be changed from the Design tab
Indicate whether the statement is true or false
Customization to the Ribbon is only applied to the Word application that is installed on the particular computer on which the customizations were made
Indicate whether the statement is true or false
Which of the following is the shortcut key for creating a hyperlink??
A. ?F12 B. ?CTRL+K C. ?SHIFT+D D. ?ALT+CTRL+H
A technician is replacing a processor that is attached parallel to the motherboard. Which of the following processor types is needed?
A. Pin grid array processor B. Slot 2 processor C. Socket to slot adapter D. Slot 1 processor