Based on the dangling-else discussion in Exercise ANS: , state the output for each of the following

Question:

Based on the dangling-else discussion in Exercise ANS: , 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.
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("$$$$$");
}

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Visual C# How to Program

ISBN: 978-0134601540

6th edition

Authors: Paul J. Deitel, Harvey Deitel

Question Posted: