This loop make in Console Application. Don't worry work every where. This type of question asking in interview.
- class Program
- {
-
- static void Main(string[] args)
- {
- int i = 0;
- first:
- for (; ; ) { if (i <= (i = i == 10 ? 0 : i += 1)) Console.WriteLine((i).ToString()); goto again; }
- again:
- if (i != 10)
- goto first;
-
- }
- }
Output above loop:
1
2
3
4
5
6
7
8
9
10
Press any key for Continue .......
Happy Coding