怎样输出个扬辉三角形~~~~~~~~~
                 1
                 1 1
                 1 2  1
                 1 3  3  1
                 1 4  6  4  1
                 1 5 10  10 5 1
                 .................
      我是个刚刚开始学C#的。请教教。谢谢~~~~~~~~~~~

解决方案 »

  1.   

    http://dev.csdn.net/article/46/46071.shtm
      

  2.   

    using System;namespace app2_1
    {
    class app2_1
    {

    [STAThread]
    static void Main(string[] args)
    {
    yanghui();
    }
    static void yanghui()
    {
    Console.WriteLine("input number");
    int n=Convert.ToInt32(Console.ReadLine())+1;
    if(n>=1&&n<=1000)
    {
    double [,] a=new double[n,n];
    a[0,1]=1;
    Console.WriteLine(a[0,1]);
    for(int i=1;i<n-1;i++)
    {
    for(int j=1;j<=i+1;j++)
    {
    a[i,j]=a[i-1,j]+a[i-1,j-1];
    Console.Write(a[i,j].ToString()+"\t");
    }
    Console.Write("\r\n");
    }
    yanghui();
    }
    else
    {
    Console.WriteLine("plese input right number!");
    yanghui();
    }
    } }
    }