using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace PascalsTriangle { class Program { static void Main(string[] args) { int n=5; //Console.Write("Enter the number of rows: "); //n = Convert.ToInt32(Console.ReadLine()); for (int y = 0; y < n; y++) { int c = 1; Console.WriteLine("\t"); int centeringNum = (n - y); if (y % 2 != 0) { centeringNum++; } else { Console.Write(" "); } for (int j = 0; j < (centeringNum); j++) { Console.Write(" "); } for (int x = 0; x <= y; x++) { Console.Write(c + " "); c = c * (y - x) / (x + 1); } Console.Write(" "); } Console.ReadLine(); } } }