Use byte to control for loop : For : Statement C# Examples


C# Examples » Statement » For »

 

Use byte to control for loop









    
using  System;  
  
class  MainClass  {        
    public  static  void  Main()  {        
        byte  x;  
        int  sum;  
  
        sum  =  0;  
        for(x  =  1;  x  <=  100;  x++)  
            sum  =  sum  +  x;  
  
        Console.WriteLine("Summation  of  100  is  "  +  sum);  
    }        
}
    
   
  
   



Output

Summation of 100 is 5050


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Statement
» For