using System; using System.Collections.Generic; using System.Linq; using System.Text;
namespace ConsoleApplication1 { class Program { static void Main(string[] args) { int a; Console.WriteLine("请输入长度"); a = int.Parse(Console.ReadLine()); int [][]w=new int[a][]; for (int i = 0; i < w.Length; i++) { w[i] = new int[i + 1]; } for (int i = 0; i < a; i++) { w[i][0] = 1; w[i][i] = 1;
} for (int i = 2; i < a; i++) { for (int j = 1; j < i; j++) { w[i][j] = w[i - 1][j] + w[i - 1][j - 1];
} } for (int i = 0; i < a; i++) { for (int y = 0; y < a-i; y++) { Console.Write(" "); } for (int j = 0; j <=i; j++) { Console.Write(w[i][j] + " "); } Console.WriteLine(" "); } } } }