标签:lin static har || div padleft ons class ++
static void YangHui(int n) { var arr = new int[n,n]; for (var i = 0; i < n; i++) { Console.Write("".PadLeft(n-i)); for (var j = 0; j <= i; j++) { if (i == j||j==0) { arr[i,j] = 1; } else if (i > 0 && j > 0) { arr[i,j] = arr[i - 1,j - 1] + arr[i - 1,j]; } Console.Write(arr[i, j] + " "); } Console.WriteLine(); } }
标签:lin static har || div padleft ons class ++
原文地址:https://www.cnblogs.com/dongteng/p/14340172.html