posted 24 years ago
anonymous (?),
Let's trace the program:
Enter loop one
When i = 0,
Enter loop two.
When j = 0, both condition one and two are false. So, print i = 0 and j = 0.
When j = 1, both condition one and two are false. So, print i = 0, and j = 1.
When j = 2, condition one is false, condtion two is true. So, go back to loop one, without printing the values.
When i = 1
Enter loop two.
When j = 0, both condtion one and two are false. So, print i = 1 and j = 0.
When j = 1, both condtion one and two are false. So, print i = 1 and j = 1.
When j = 2, condtion one is false, condtion two is true. So, go back to loop one, without printing the values.
When i = 2,
Enter loop two.
Throughout the loop i will be two and hence condtion one will evaluate to true all the time and hence, it won't come the printing statement.
So, the output will be
0,0
0,1
1,0
1,1.
So, a,b,c and d are the correct answers.
Regards,
Suresh.