Game With For Loops

This loop make in Console Application. Don't worry work every where. This type of question asking in interview.

  1. class Program  
  2. {  
  3.   
  4.     static void Main(string[] args)  
  5.     {  
  6.         int i = 0;  
  7.     first:  
  8.         for (; ; ) { if (i <= (i = i == 10 ? 0 : i += 1)) Console.WriteLine((i).ToString()); goto again; }  
  9.     again:  
  10.         if (i != 10)  
  11.             goto first;  
  12.   
  13.     }  
  14. }  
Output above loop:

1
2
3
4
5
6
7
8
9
10

Press any key for Continue .......

Happy Coding