What will be the output of this code?
for (int i = 1; i <= 3; i++)
{
for (int j = i; j <= 3; j++)
{
Console.Write(j + "");
}
Console.WriteLine();
}

1) 1
12
123

2) 1
21
321

3)123
23
3

4)None of these

 Posted by Ddd on 3/17/2011 | Category: C# Interview questions | Views: 7116 | Points: 40
Select from following answers:
  1. 1
  2. 2
  3. 3
  4. None of these
  5. All Above

Show Correct Answer


| Alert Moderator 

Comments or Responses

Posted by: Abhisekjani on: 3/19/2011 | Points: 10
Actual answer is None of these. Because there is no space between the numerics.
Hope you will take it positively.

Thanks,
Abhisek
Posted by: Ddd on: 3/20/2011 | Points: 10
The answer is
123
23
3.
It is clearly mentioned in the explanation. In the question, the option might have got misaligned
for which I should not be blamed,
Thanks.
Posted by: Abhisekjani on: 3/20/2011 | Points: 10
I am not blaming you. In this question you have given very good explanation.
But what I mean to say is, the answer is
1 2 3
2 3
3

Thanks.

Login to post response