Mega Code Archive

 
Categories / C# Tutorial / Development
 

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);    }     } 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