static void Main(string[] args) { int i = 10 , j = 0; label: i--; if ( i > 0) { Console.WriteLine(i+ " "); goto label; } Console.ReadLine(); }
a) 1 2 3 4 5 6 7 8 9 10
b) 10 9 8 7 6 5 4 3 2 1 0
c) 9 8 7 6 5 4 3 2 1
d) 10 9 8 7 6 5 4 3 2 1
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
c
Explanation: for i = 10, loop executes for first time in ‘if’ loop as (i>0) i.e (9 > 0) and hence printing ‘9’. Similarly, label condition executes again go for (i–) i.e (9-1=8) and hence again prints i = 8. In this way looping condition executes as 9, 8 to 3, 2, 1.
OUTPUT :
9 8 7 6 5 4 3 2 1