杨辉三角
来源:互联网 发布:免费网络电话软件排名 编辑:程序博客网 时间:2024/05/18 05:03
//Copyright (c) 2014软件技术2班//All rights reserved. //作 者:B01 // 完成日期:2014年 11 月 25日 // 版 本 号:v1.0 // 问题描述:创建输出11行的杨辉三角// 输入描述:无 // 程序输出:杨辉三角// using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { int[,] yanghui= new int[11, 11]; for (int i = 0; i < yanghui.GetLength(0); i++) { yanghui[i, 0] = 1; yanghui[i, i] = 1; if (i > 1) { for (int j = 1; j < i; j++) { yanghui[i, j] = yanghui[i - 1, j - 1] + yanghui[i - 1, j]; } } } for (int i = 0; i < yanghui.GetLength(0); i++) { for (int j = 0; j <= i; j++) { Console.Write("{0,-4}", yanghui[i, j]); } Console.WriteLine(); } Console.ReadLine(); } }}
输出
总结:学会了二维数组的运用
0 0
- 杨辉三角/帕斯卡三角
- (尹成)杨辉三角(正三角 倒三角)
- 学习:杨辉三角(帕斯卡三角)
- 杨辉三角
- 杨辉三角
- 杨辉三角
- 杨辉三角算法
- C# 杨辉三角
- 杨辉三角
- 杨辉三角
- 杨辉三角程序
- 打印杨辉三角
- 杨辉三角
- 杨辉三角
- 杨辉三角
- 杨辉三角源代码
- 杨辉三角~~~~~~~~
- 杨辉三角
- ios代码大全】代码例子区全区搜索索引
- 枚举
- 线程同步锁对象不同导致的安全问题及解决办法
- 实战剖析三层架构3:不要说BLL没有用
- Property type 'id<xxxxTabBarDelegate>' is incompatible with type 'id<UITabBarDelegate>' inherited fr
- 杨辉三角
- codeforces#280(div2)
- Java 与 C 之间传递数据
- 2014.12.02MySQL
- 编译原理结构框架6语法制导翻译与属性文法
- 【C语言疯狂讲义】(十六)C语言简易通讯录(未优化版)
- action,,,submit控制表单
- HDU 1297 Children’s Queue
- 【DP】HDU-1502 Regular Words