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
#####
$$$$$

Computer Science & Information Technology

You might also like to view...

In Project 2013, a light gray vertical bar in a Gantt chart represents a ________

A) nonworking day B) task C) timeline D) working day

Computer Science & Information Technology

Give an example of a set of clusters in which merging based on the closeness of clusters leads to a more natural set of clusters than merging based on the strength of connection (interconnectedness) of clusters.

What will be an ideal response?

Computer Science & Information Technology