C#窗体程序:设计一个Windows应用程序

设计一个Windows应用程序,使用for语句输出杨辉三角的前十行,形式如下
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1

请大神能帮忙解答,谢谢了

 using System;
using System.Collections.Generic;

public class MyClass
{
    public static void Main()
    {
        Console.Write("请输入数组的长度:"); //输入10
        int num=Convert.ToInt32(Console.ReadLine());

        int[,] arr=new int[num,num];
        for(int i=0;i<num;i++)
        {
            for(int j=0;j<num-i;j++)
            {
                Console.Write("   ");
            }
            for(int j=0;j<=i;j++)
            {
                if(j==0||j==i)
                {
                    arr[i,j]=1;
                }
                else
                {
                    arr[i,j]=arr[i-1,j]+arr[i-1,j-1];
                }
                Console.Write(arr[i,j].ToString()+"      ");
            }
            Console.WriteLine();
        }
        Console.ReadKey();
    }
}