using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication29
{
class Program
{
static void Main(string[] args)
{
//1.定义变量
int[,] n = new int[11,11];
//2.赋值
for (int i = 0; i < n.GetLength(0); i++)
{
for (int j = 0; j < n.GetLength(1); j++)
{
if (i == j || j == 0) n[i, j] = 1;
else if (i > 1) n[i, j] = n[i - 1, j - 1] + n[i - 1, j];
else n[i, j] = 0;
}
}
//3.输出
for (int i = 0; i < n.GetLength(0); i++)
{
for (int j = 0; j < n.GetLength(1); j++)
{
Console.Write(" {0} ",n[i,j]);
}
Console.WriteLine();
}
Console.ReadKey();
}
}
}
总结:第一次按照老师说的那样注释和分开写程序..在老师提示过的情况下很快写出来了