C# 中杨辉三角的实现
C#中杨辉三角的实现
问题描述:创建一个程序来求三角形。该程序提示用户输入数据,然后显示出杨辉三角的规律。
//输入描述:杨辉三角长,代表数值
//程序输出:杨辉三角
usingSystem; usingSystem.Collections.Generic; usingSystem.Linq; usingSystem.Text; namespaceConsoleApplication2 { classProgram { staticvoidMain(string[]args) { intlength=0;//杨辉三角形的长度 Console.Write("输入杨辉三角长度:"); length=Convert.ToInt32(Console.ReadLine());//指定杨辉三角形的长度 int[][]a=newint[length][];//二维数组 for(inti=0;i如有疑问请留言或者到本站社区交流讨论,感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!