 using System;
 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace 杨辉三角形
{
    class Program
    {
        static void Main(string[] args)
        {
            int[][] Array_int = new int[10][];
            for(int i=0;i<Array_int.Length;i )
            {
                Array_int[i] = new int[i  1];
                for(int j=0;j<Array_int [i].Length;j )
                {
                    if(i<=1)
                    {
                        Array_int[i][j] = 1;
                        continue;
                    }
                    else
                    {
                        if (j == 0 || j == Array_int[i].Length - 1)
                            Array_int[i][j] = 1;
                        else
                            Array_int[i][j] = Array_int[i-1][j-1]  Array_int[i-1][j];
                    }
                }
            }
            for(int i=0;i<Array_int.Length;i )
            {
                for (int j = 0; j < Array_int[i].Length; j )
                    Console.Write("{0}\t", Array_int[i][j]);
                Console.WriteLine();
            }
            Console.ReadLine();
        }
    }
}

 
  
					
				
评论