A negatively running for loop : For : Statement C# Examples


C# Examples » Statement » For »

 

A negatively running for loop









    
using  System;  
  
class  MainClass  {          
    public  static  void  Main()  {          
        int  x;  
  
        for(x  =  100;  x  >  -100;  x  -=  5)  
            Console.WriteLine(x);  
    }  
}
    
   
  
   



Output

100
95
90
85
80
75
70
65
60
55
50
45
40
35
30
25
20
15
10
5
0
-5
-10
-15
-20
-25
-30
-35
-40
-45
-50
-55
-60
-65
-70
-75
-80
-85
-90
-95


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Statement
» For