C# Programming - Control Instructions - Discussion
Discussion Forum : Control Instructions - General Questions (Q.No. 1)
1.
What does the following C#.NET code snippet will print?
int i = 0, j = 0;
label:
i++;
j+=i;
if (i < 10)
{
Console.Write(i +" ");
goto label;
}
Discussion:
14 comments Page 2 of 2.
Koti said:
9 years ago
J+=i?
J+i=i
Is it right or worng?
Please tell me.
J+i=i
Is it right or worng?
Please tell me.
Pavithra said:
8 years ago
J+=i says j=i+1
J+i=i
Both are same @Koti.
J+i=i
Both are same @Koti.
Sivaleela said:
7 years ago
It's not a while loop, it is just an if loop then how may it will repeat the loop. I think it will print only 1.
Output = 1
Output = 1
Ankita said:
6 years ago
It's a loop. If the condition gets true, it will go further until it gets false.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers