Use format commands : Console Output Format : Development C# Examples


C# Examples » Development » Console Output Format »

 

Use format commands









    
using  System;  
  
class  Example  {        
    public  static  void  Main()  {        
        int  i;  
  
        Console.WriteLine("Value\tSquared\tCubed");  
  
        for(i  =  1;  i  <  10;  i++)  
            Console.WriteLine("{0}\t{1}\t{2}",    
                                                i,  i*i,  i*i*i);  
    }        
}
    
   
  
   



Output

Value   Squared Cubed
1       1       1
2       4       8
3       9       27
4       16      64
5       25      125
6       36      216
7       49      343
8       64      512
9       81      729


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Development
» Console Output Format