当前位置:网站首页>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;
}
边栏推荐
- Four ways to clear the float and its principle understanding
- The pre-sale of the new Hyundai Paristi is open, and safety and comfort are not lost
- DELL SC compellent 康贝存储系统怎么抓取配置信息
- 尚硅谷-JVM-内存和垃圾回收篇(P1~P203)
- VU 非父子组件通信
- Shell script classic case: detecting whether a batch of hosts is alive
- Comparison of Optical Motion Capture and UWB Positioning Technology in Multi-agent Cooperative Control Research
- 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
- 为什么 wireguard-go 高尚而 boringtun 孬种
- 1小时直播招募令:行业大咖干货分享,企业报名开启丨量子位·视点
猜你喜欢

为什么要分库分表?

一篇文章讲清楚!数据库和数据仓库到底有什么区别和联系?

jvm 一之 类加载器

SetoolKit User Guide

【redis】发布和订阅消息

DELL SC compellent 康贝存储系统怎么抓取配置信息

The recently popular domestic interface artifact Apipost experience

Samba 远程命令执行漏洞(CVE-2017-7494)

endnote引用

已解决(pymysqL连接数据库报错)pymysqL.err.ProgrammingError: (1146,“Table ‘test.students‘ doesn‘t exist“)
随机推荐
3.爬虫之Scrapy框架1安装与使用
C语言基础练(九九乘法表)与打印不同星号图案
推荐系统-召回阶段-2013:DSSM(双塔模型)【Embedding(语义向量)召回】【微软】
Redis与分布式:集群搭建
AWS implements scheduled tasks - Lambda+EventBridge
Open Inventor 10.12 重大改进--和谐版
线程池的使用二
Nuget package and upload tutorial
[QNX Hypervisor 2.2 User Manual] 9.13 rom
Nuget打包并上传教程
LeetCode·每日一题·1161.最大层内元素和·层次遍历
机器学习模型验证:被低估的重要一环
技能大赛dhcp服务训练题
Use of C# Assembly
使用CompletableFuture进行异步处理业务
【Pytorch】F.softmax()方法说明
“听我说谢谢你”还能用古诗来说?清华搞了个“据意查句”神器,一键搜索你想要的名言警句...
Resnet&API
All-round visual monitoring of the Istio microservice governance grid (microservice architecture display, resource monitoring, traffic monitoring, link monitoring)
Buffer 与 拥塞控制