当前位置:网站首页>C language basic practice (nine-nine multiplication table) and printing different asterisk patterns
C language basic practice (nine-nine multiplication table) and printing different asterisk patterns
2022-07-31 14:09:00 【Script kid】
C语言实现九九乘法表的输出
#include<stdio.h>
int main()
{
int i = 0;
for (i = 1; i <= 9; i++)
{
int j = 0;
for (j = 1; j <= i; j++)
{
printf("%d*%d=%d ", i, j, i * j);
}
printf("\n");
}
return 0;
}
输出为
1*1=1
2*1=2 2*2=4
3*1=3 3*2=6 3*3=9
4*1=4 4*2=8 4*3=12 4*4=16
5*1=5 5*2=10 5*3=15 5*4=20 5*5=25
6*1=6 6*2=12 6*3=18 6*4=24 6*5=30 6*6=36
7*1=7 7*2=14 7*3=21 7*4=28 7*5=35 7*6=42 7*7=49
8*1=8 8*2=16 8*3=24 8*4=32 8*5=40 8*6=48 8*7=56 8*8=64
9*1=9 9*2=18 9*3=27 9*4=36 9*5=45 9*6=54 9*7=63 9*8=72 9*9=81
D:\visual studio program\demo.cpp\x64\Debug\ConsoleApplication5.exe (进程 11860)已退出,代码为 0.
要在调试停止时自动关闭控制台,请启用“工具”->“选项”->“调试”->“调试停止时自动关闭控制台”.
按任意键关闭此窗口. .
打印平行四边形
#include <stdio.h>
int main()
{
int i, j, n;
scanf("%d", &n);//The number of lines to print the parallelogram
for (i = 1; i <= n; i++)
{
for (j = 1; j <= n - i; j++)
{
printf(" ");
}
for (j = 1; j <= n; j++)
{
printf("* ");
}
printf("\n");
}
return 0;
}
打印顶角朝上的等腰三角形
#include <stdio.h>
int main()
{
int i, j, n;
scanf("%d", &n);//Print the number of rows of an isosceles triangle
for (i = 1; i <= n; i++)
{
for (j = 1; j <= n - i; j++)
{
printf(" ");
}
for (j = 1; j <= 2 * i - 1; j++)
{
printf("*");
}
printf("\n");
}
return 0;
}
打印top corner down的等腰三角形
#include <stdio.h>
int main ()
{
int i,j,n;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=i-1;j++)
{
printf(" ");
}
for(j=1;j<=2*n-2*i+1;j++)
{
printf("*");
}
printf("\n");
}
return 0;
}
边栏推荐
- Analysis of the startup source code of hyperf (2) - how the request reaches the controller
- 动作捕捉系统用于柔性机械臂的末端定位控制
- 技能大赛训练题:交换机虚拟化练习
- 小试牛刀:Go 反射帮我把 Excel 转成 Struct
- Motion capture system for end-positioning control of flexible manipulators
- 「面经分享」西北大学 | 字节 生活服务 | 一面二面三面 HR 面
- C# using NumericUpDown control
- 技能大赛训练题:域用户和组织单元的创建
- jvm 一之 类加载器
- 新款现代帕里斯帝预售开启,安全、舒适一个不落
猜你喜欢

技能大赛训练题:ftp 服务攻防与加固

Open Inventor 10.12 重大改进--和谐版

ADS communicate with c #

Samba 远程命令执行漏洞(CVE-2017-7494)
![Miller_Rabin Miller Rabin probability sieve [template]](/img/51/8dcc9f78478debf7d3dcfa6d1a23e3.png)
Miller_Rabin Miller Rabin probability sieve [template]

推荐系统-召回阶段-2013:DSSM(双塔模型)【Embedding(语义向量)召回】【微软】

Nuget打包并上传教程

Asynchronous processing business using CompletableFuture

MySQL【聚合函数】

C# control StatusStrip use
随机推荐
I summed up the bad MySQL interview questions
什么是消息队列呢?
C# using NumericUpDown control
ML, DL, CV common problems sorting
The latest complete code: Incremental training using the word2vec pre-training model (two loading methods corresponding to two saving methods) applicable to various versions of gensim
八大排序汇总及其稳定性
技能大赛训练题: 子网掩码划分案例
Shell脚本经典案例:探测批量主机是否存活
4.爬虫之Scrapy框架2数据解析&配置参数&数据持久化&提高Scrapy效率
uniapp微信小程序引用标准版交易组件
The recently popular domestic interface artifact Apipost experience
leetcode:2032. 至少在两个数组中出现的值
常用工具命令速查表
【Pytorch】torch.argmax()用法
Node version switching management using NVM
尚硅谷-JVM-内存和垃圾回收篇(P1~P203)
MySQL 23 classic interviews hang the interviewer
最近很火的国产接口神器Apipost体验
Four ways to clear the float and its principle understanding
Why do we need to sub-library and sub-table?