当前位置:网站首页>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串口和CAN数据动态实时显示最后日志
- 《C陷阱和缺陷》void (*signal(int , void(*)(int)))(int)的深刻解读
- CPU缓存一致性问题
- Real-time waveform display of CAN communication data based on QT (serial eight) ==== "Sub function or new class calls ui control"
- Cannnot download sources不能下载源码百分百超详细解决方案
- [Quick MSP430f149] Notes on learning MSP430f149 during the game
- C language, usage of qsort in library function, and explanation
- 创建快捷方式时如何不带“快捷方式“后缀字样?
- 【已解决:el-input标签无法输入或不显示文字】
- Vim查找字符
猜你喜欢

Kunlun State Screen Production (Serialization 2)---Basic Chapter (setting and display, serial transmission)

QT weekly skills (2)~~~~~~~~~ interface buttons

TCP建立连接的过程
CPU的三种工作模式:实模式、保护模式、长模式

ES6 syntax notes (ES6~ES11)

"R Language + Remote Sensing" Comprehensive Evaluation Method of Water Environment

主机和从机配置,建立ssh连接实现Rviz远程控制

三种内核结构---宏内核、微内核、混合内核

干货 | 什么是FOC?一文带你看BLDC电机驱动芯片及解决方案

Kunlun On-state Screen Production (serial 1)---Contact
随机推荐
Kunlun On-state Screen Production (serial 1)---Contact
this的指向问题
Antd 树拖拽一些细节,官网没有,摸坑篇
Diwen serial screen production (serialization 1) ===== preparation work
华秋第八届硬创大赛携手NVIDIA初创加速计划,赋能企业发展
Insertion Sort in Classic Sort
与所有 ARM 工具、软件兼容?韦斯佰瑞这款MCU内核值得关注!
vscode 设置 sublime 的主题
昆仑通态屏幕制作(连载2)---基础篇(设定与显示,串口发送)
ipconfig命令指南
如何判断 PCB 板是否变形?
VsCode连接远程服务器并修改文件代码
超详细的PCB高可靠辨别方法
PCB 一分钟科普之你真的懂多层板吗?
【部分项目展示】
Simple use of xftp
迪文串口屏幕制作(连载一)=====准备工作
Comparison of advantages and disadvantages of VsCode and Sublime editors
Duplicate keys detected:‘/da…‘
华秋第八届硬创赛与安创加速器达成战略合作,助力硬科技项目成长