当前位置:网站首页>九九乘法表——C语言
九九乘法表——C语言
2022-06-27 19:53:00 【喵喵喵更多】
(1)九九乘法表左下三角打印
#include<stdio.h>
int main(){
int i, j, sum;
for(i=1;i<=9;i++){
for(j=1;j<=i;j++){
sum=i*j;
printf("%d * %d= %2d ",i,j,sum);
}
printf("
");
}
return 0;
}
(2)右下三角打印
#include<stdio.h>
int main(){
int i, j,k, sum;
for(i=1;i<=9;i++){
for(k=1;k<=9-i;k++){
printf(" ");
}
for(j=1;j<=i;j++){
sum=i*j;
printf("%d * %d= %2d ",i,j,sum);
}
printf("
");
}
return 0;
}
(3)右上三角打印
#include<stdio.h>
int main(){
int i, j, sum;
for(i=1;i<=9;i++){
for(j=1;j<=9;j++){
if(j<i){
printf(" ");
}
else{
sum=i*j;
printf("%d * %d= %2d ",i,j,sum);
}
}
printf("
");
}
return 0;
}
(4)左上三角打印
#include<stdio.h>
int main(){
int i, j, sum;
for(i=1;i<=9;i++){
for(j=i;j<=9;j++){
sum=i*j;
printf("%d * %d= %2d ",i,j,sum);
}
printf("
");
}
return 0;
}
(5)矩形九九乘法表打印
#include<stdio.h>
int main(){
int i, j, sum;
for(i=1;i<=9;i++){
for(j=1;j<=9;j++){
sum=i*j;
printf("%d * %d= %2d ",i,j,sum);
}
printf("
");
}
return 0;
}
边栏推荐
- YOLOv6:又快又准的目标检测框架开源啦
- Codeforces Round #717 (Div. 2)
- 中金证券经理给的开户链接办理股票开户安全吗?我想开个户
- 正则表达式
- How to do function test well? Are you sure you don't want to know?
- 管理系统-ITclub(下)
- [LeetCode]161. Edit distance of 1
- Stm32f107+lan8720a use stm32subemx to configure network connection +tcp master-slave +udp app
- Deep learning has a new pit! The University of Sydney proposed a new cross modal task, using text to guide image matting
- Go from introduction to practice - error mechanism (note)
猜你喜欢
Codeforces Round #719 (Div. 3)
从学生到工程师的蜕变之路
Yolov6: the fast and accurate target detection framework is open source
Do280openshift access control -- Security Policy and chapter experiment
二维数组中修改代价最小问题【转换题意+最短路径】(Dijkstra+01BFS)
Read write separation master-slave replication of MySQL
Gao fushuai in the unit testing industry, pytest framework, hands-on teaching, will do this in the future test reports~
爬虫笔记(1)- urllib
Codeforces Round #723 (Div. 2)
I think I should start writing my own blog.
随机推荐
Go from introduction to actual combat - execute only once (note)
[MySQL practice] query statement demonstration
Management system itclub (medium)
【Redis】零基础十分钟学会Redis
Summary of gbase 8A database user password security related parameters
crontab定时任务常用命令
《7天學會Go並發編程》第7天 go語言並發編程Atomic原子實戰操作含ABA問題
Simulink method for exporting FMU model files
Conversation Qiao Xinyu: l'utilisateur est le gestionnaire de produits Wei Brand, zéro anxiété définit le luxe
Crontab scheduled task common commands
Golang uses regularity to match substring functions
The karsonzhang/fastadmin addons provided by the system reports an error
解决本地连接不上虚拟机的问题
从学生到工程师的蜕变之路
《7天学会Go并发编程》第7天 go语言并发编程Atomic原子实战操作含ABA问题
Analysis of stone merging
结构化机器学习项目(二)- 机器学习策略(2)
Test birds with an annual salary of 50w+ are using this: JMeter script development -- extension function
管理系统-ITclub(中)
Is it safe to open a stock account through the account opening link given by the CICC securities manager? I want to open an account