using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace YHtriangle
{
class Program
{
static void Main()
{
int[,] a = new int[6, 6];
a[0, 0] = 1;
for (int i = 1; i <= 5; i++)
{
a[i, 0] = 1;
a[i, i] = 1;
for (int j = 1; j <= i; j++)
{
a[i, j] = a[i - 1, j - 1] + a[i - 1, j];
}
}
for (int i = 0; i <= 5; i++)
{
for (int j = 0; j <= i; j++)
{
Console.Write("{0}\0", a[i, j]);
}
Console.WriteLine();
}
}
}
}
C#之二维数组学习案例
本文转载:CSDN博客