Pascal triangle programming in C#

Pascal triangle calculation is showing the triangle with the multiplication of 11 of numbers diagonally. (Starting with one)


using System;

namespace forgetCode
{
    class Program
    {
        public static void Main()
        {
            int binom = 1, q = 0, r, x;
           
            //Input from the user
            Console.WriteLine("Enter the number of rows");
            string s = Console.ReadLine();
            int p = Int32.Parse(s);
           
            Console.WriteLine("The Pascal Triangle");
            while (q < p)
            {
                //Pascal programming

                for (r = 40 - (3 * q); r > 0; --r)
                    Console.Write(" ");
                for (x = 0; x <= q; ++x)
                {
                    if ((x == 0) || (q == 0))
                        binom = 1;
                    else
                        binom = (binom * (q - x + 1)) / x;
                    Console.Write(binom);
                }
                Console.Write("\n ");
                ++q;
            }
        }
    }

}


Output:
Enter the number of rows
5
The Pascal Triangle
1
11
121
1331
14641

(But the output is actually shown in diagonally)

..