当前位置:网站首页>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
--------------------------
边栏推荐
- antd table Summary总结栏置顶
- ES6语法笔记(ES6~ES11)
- jvm之方法区
- 与所有 ARM 工具、软件兼容?韦斯佰瑞这款MCU内核值得关注!
- xftp的简单使用
- [Jiangsu University Self-Chemistry Association stm32F103c8t6] Notes [Introduction to 32 MCUs and Using TIM Output to Compare and Configure PWM]
- 三种内核结构---宏内核、微内核、混合内核
- Comparison of advantages and disadvantages of VsCode and Sublime editors
- "R Language + Remote Sensing" Comprehensive Evaluation Method of Water Environment
- 无法完成包的安装npm ERR! Refusing to install package with name “moment“ under a package also called “moment“
猜你喜欢
[Jiangsu University Self-Chemistry Association stm32F103c8t6] Notes [Introduction to 32 MCUs and Using TIM Output to Compare and Configure PWM]
Kunlun On-state Screen Production (serial 1)---Contact
Three working modes of CPU: real mode, protected mode, long mode
This beta version of Typora is expired, please download and install a newer; workaround
QT连载1:readyRead()函数,数据分包不完整解决办法
Anaconda 安装低版本tensorflow
xftp的简单使用
SSH-RSA密钥
VsCode连接远程服务器并修改文件代码
【已解决:el-input标签无法输入或不显示文字】
随机推荐
Antd 树拖拽一些细节,官网没有,摸坑篇
HSPF model application
高效插入map数据
逻辑右移和算术右移区别
C language, usage of qsort in library function, and explanation
clinit方法
Through the bit operations to convert the characters are case sensitive
无法完成包的安装npm ERR! Refusing to install package with name “moment“ under a package also called “moment“
TCP建立连接的过程
CPU的三种工作模式:实模式、保护模式、长模式
QT serial 4: LORA test platform based on QT and STM32H750 (3)
干货:线上下单应知应会,快来了解下
Simple use of xftp
Written before the official account - QT, ARM, DSP, microcontroller, power electronics and transmission!
《C陷阱和缺陷》void (*signal(int , void(*)(int)))(int)的深刻解读
Duplicate keys detected:‘/da…‘
多层板的层数,为啥选项都是偶数?就不能选奇数?
Insert map data efficiently
ipconfig Command Guide
[Common usage of markdown]