当前位置:网站首页>c语言编程练习
c语言编程练习
2022-07-30 05:46:00 【缘聚654】
输出杨辉三角
#include<stdio.h>
#define N 11
int main()
{
int i,j,y[N][N];
for(i=1;i<N;i++)
{
y[i][1]=y[i][i]=1;
for(j=2;j<=i-1;j++)
y[i][j]=y[i-1][j]+y[i-1][j-1];
}
for(i=1;i<N;i++)
{
for(j=1;j<=i;j++)
printf("%4d",y[i][j]);
printf("\n");
}
}运行结果
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1
1 7 21 35 35 21 7 1
1 8 28 56 70 56 28 8 1
1 9 36 84 126 126 84 36 9 1
--------------------------边栏推荐
- 每日一知识:手写深拷贝和浅拷贝(解决了循环引用的问题)
- 虚拟机栈帧结构
- QT连载2:基于QT和STM32H750的LORA试验平台(1)
- Vim查找字符
- FPGA parsing B code----serial 2
- 动态规划进阶 JS
- sizeof和strlen最全区别,以及指针和数组运算解析
- FPGA parsing B code----serial 1
- [Jiangsu University Self-Chemistry Association stm32F103c8t6] Notes [Introduction to 32 MCUs and Using TIM Output to Compare and Configure PWM]
- 自定义类加载器
猜你喜欢
随机推荐
-----博客声明
服务器基础知识:包含基本概念,作用,服务器选择,服务器管理等(学习来自米拓建站)
工程师必看:常见的PCB检测方法有哪些?
C语言,库函数中qsort的用法,及解释
超详细的PCB高可靠辨别方法
Delete all files containing a keyword in the current path
2021年软考中级过关
如何判断 PCB 板是否变形?
Antd简单启动一个企业级项目
你不知道的JS思考题
OpenLayers 初学者指南,源码测试可用
(*(void (*)())0)() Interpretation
每日一知识:手写深拷贝和浅拷贝(解决了循环引用的问题)
使用Dva项目作Antd的Demo
[Jiangsu University of Science and Technology Automation Association stm32F103c8t6] Notes [Initial 32 MCU and TIM timing interrupt initialization parameter configuration]
QT serial and CAN dynamic real-time display the log data
[Quick MSP430f149] Notes on learning MSP430f149 during the game
关于map对key自定义排序
2020-09-03 Solve the very slow installation of pip install [Errno 101] Network unreachable problem
探究make_shared效率

![[Punctuality Atom] Learning and use of IIC (unfinished...)](/img/b7/325cad848eacee67c56c6cad321bd0.png)







