程序设计:杨辉三角

01.//  

02.// Copyright (c) 2014软件技术2班  

03.// All rights reserved.   

04.// 作    者:B05 李刘杰

05.// 完成日期:2014年 11 月 22日   

06.// 版 本 号:v1.0   

07.//   

08.// 问题描述:创建一个程序来呈现01.//  

02.// Copyright (c) 2014软件技术2班  

03.// All rights reserved.   

04.// 作    者:B05 李刘杰

05.// 完成日期:2014年 10 月 24日   

06.// 版 本 号:v1.0   

07.//   

08.// 问题描述:创建一个程序来呈现杨辉三角前11行
09.// 输入描述:定义行,列还有输入行和列的规律

10.// 程序输出:杨辉三角前11行

11.//

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace ConsoleApplication58

{

    class Program

    {

        static void Main(string[] args)

        {

            int[,] a = new int[11, 11];  

            for (int i = 0; i <11; i ++)         

            {               

                for (int j = 0; j  <=i; j++)          

                {                  

                    if ( i== j || j  == 0)            

                     a[i,j] = 1;                

                    else                     

                    a[i, j] = a[i  – 1, j – 1] + a[i – 1,j ];

                    Console.Write(a[i, j] + ” “);             

                }        

                Console.WriteLine();           

         }           

            Console.Read();

        }

        }

    }

12//.效果图:
《程序设计:杨辉三角》

总结:1.通过本作业我学会了设计有关二维数组程序知识

2.解决了相关程序计算的问题,增长了经验,收获了自信

3.有利于后面程序问题的解决,增强了我对程序设计的兴趣

    原文作者:杨辉三角问题
    原文地址: https://blog.csdn.net/evan105/article/details/41343073
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞