杨辉三角
来源:互联网 发布:汽车网络推广 编辑:程序博客网 时间:2024/05/16 19:11
- //
- // Copyright (c) 2014软件技术1班
- // All rights reserved.
- // 作 者:A30 黄勇华
- // 完成日期:2014年 11 月 24 日
- // 版 本 号:v1.0
- //
- // 问题描述:用数组在控制台输出杨辉三角
- // 输入描述:
- // 程序输出:输出杨辉三角形
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace 杨辉三角
- {
- class Program
- {
- static void Main(string[] args)
- {
- int length = 10;
- int[][] a = new int[length][];
- for (int i = 0; i < a.Length; i++)
- a[i] = new int[i + 1];
- for (int j = 0; j < a.Length; j++)
- {
- a[j][0] = 1;
- a[j][j] = 1;
- for (int m = 1; m < a[j].Length - 1; m++)
- a[j][m] = a[j - 1][m - 1] + a[j - 1][m];
- }
- for (int i = 0; i < a.Length; i++)
- {
- for (int j = 0; j < a[i].Length; j++)
- Console.Write("{0}\t", a[i][j]);
- Console.Write("\n");
- }
- Console.Read();
- }
- }
- }
- 输出:
- 总结:
- 1.学会对数组的应用
- 2.加深对数组输出的理解
0 0
- 杨辉三角/帕斯卡三角
- (尹成)杨辉三角(正三角 倒三角)
- 学习:杨辉三角(帕斯卡三角)
- 杨辉三角
- 杨辉三角
- 杨辉三角
- 杨辉三角算法
- C# 杨辉三角
- 杨辉三角
- 杨辉三角
- 杨辉三角程序
- 打印杨辉三角
- 杨辉三角
- 杨辉三角
- 杨辉三角
- 杨辉三角源代码
- 杨辉三角~~~~~~~~
- 杨辉三角
- Cheap nfl super bowl jerseys wholesale from china
- wholesale stitched jerseys from china
- 十六进制与十进制之间的转换
- 搜索引擎项目文档-----环境搭建
- 在排序数组中的出现次数 Count the number of occurrences in a sorted array
- 杨辉三角
- cocos2dx ver3.3 的Sprite3DTest 例子中可以学到什么
- cheap authentic jerseys from china
- [分享]Ubuntu12.04安装基础教程(图文)
- 图 DFS BFS 回溯
- Ubuntu12.04安装Jdk1.7
- cheap china nfl jerseys
- hats and jerseys for cheap
- wholesale jerseys and hats china