Ankit Gupta

Ankit Gupta

  • NA
  • 14
  • 10.5k

Multiplication Tables

Oct 2 2012 3:13 AM
Hello sir i am stuck in this question can you please help me in this

Print out the grade school multiplication table upto 12*12.

None
Print out the table in a matrix like fashion, each number formatted to a width of 4 (The numbers are right-aligned and strip out leadeing/trailing spaces on each line). The first 3 line will look like: 
e.g.

1   2   3   4   5   6   7   8   9  10  11  12
2 4 6 8 10 12 14 16 18 20 22 24
3 6 9 12 15 18 21 24 27 30 33 36
i am trying it but its not working
int i,j,sum=0;            
            for (i = 1; i <= 10; i++)
            {
                for (j = 1; j <= 12; j++)
                {
                    sum = i * j;                    
                    Console.Write(sum+"\t");
                }
                Console.WriteLine();
            }
            Console.ReadLine();

Answers (2)