当前位置:网站首页>C language to print a specific * asterisk pattern on the screen
C language to print a specific * asterisk pattern on the screen
2022-07-22 15:45:00 【Serendipity_-】
The effect to be achieved is shown in the figure :
Ideas :
use for Loop nesting realizes the outer loop to control the number of rows , The inner loop controls the number of rows .
#include <stdio.h>
int main()
{
int n, i, j, s;
scanf("%d", &n);
for (i = 0; i < n; i++)
{
for (j = 0; j <= i; j++)
{
printf("*");
}
printf("\n");
}
for (i = 0; i < n; i++)
{
for (s = 0; s < i; s++)
{
printf(" ");
}
for (j = 0; j < n - i; j++)
{
printf("*");
}
printf("\n");
}
return 0;
}
The operation results are as follows :
边栏推荐
- 記一次jmeter壓測實戰總結
- TiDB中规划的集群包括6个DB,3个pd,3个kv,应用去连的时候,是连哪个地址?
- 产业数字化全面加速,智能云网2.0重新定义数字化转型
- Summary of URL rules for real-time streaming of Hikvision, Dahua and yushila
- Cloud native
- Code shoe set - mt2201 · sum of all
- Redis高可用原理 主从哨兵集群
- 第3章——创建与维护MySQL数据表
- The first session of Niuke 2022 summer training c question grab the seat! Solution
- JS高级 之 ES6 实现继承
猜你喜欢
面试刁钻问题应对思路
Record a summary of JMeter pressure test practice
QT 动态dll的创建和调用
Chapter 3 - creating and maintaining MySQL data tables
Halcon displays point clouds in TXT file format
ROS2自学笔记:TF坐标管理
别找了,全都帮你整理好了——SQL语句大全
[fiddlertx plug-in] use Fiddler to capture Tencent classroom video download
牛客2022暑期集训第一场C题 Grab the Seat! 题解
TDengine實驗集群搭建 Success
随机推荐
玩转CANoe,博客目录大全
深度学习之 8 深度模型优化与正则化
GeneralizedRCNN:features = OrderedDict([(“0“, features)])
浏览器无痕浏览还能查到记录吗,如何开启无痕模式
C语言实现在屏幕上打印特定的*星号图案
2022.7.21 special matrix compression
JS高级 之 ES6 实现继承
Record a summary of JMeter pressure test practice
Bannertext (watermark text)
EACCES: permission denied, unlink ‘/usr/local/bin/code‘
[C language - file] the data can finally be out of the memory. Go to the outside world to have a look / (o)/~~
MySQL (28) - transaction related
Can Oracle RAC be built on Youxuan database?
Debugging VBS Visual Studio
产业数字化全面加速,智能云网2.0重新定义数字化转型
__call__函数
Tensorboard安装与使用
【06】指令跳转:原来if...else就是goto
Nifi 1.16.3 updates and bugs used in production.
认识垃圾回收