当前位置:网站首页>7-20 print 99 formula table (format output)
7-20 print 99 formula table (format output)
2022-07-03 14:14:00 【Big fish】
Here's a complete list of the bottom triangle and nine nines :
1*1=1
1*2=2 2*2=4
1*3=3 2*3=6 3*3=9
1*4=4 2*4=8 3*4=12 4*4=16
1*5=5 2*5=10 3*5=15 4*5=20 5*5=25
1*6=6 2*6=12 3*6=18 4*6=24 5*6=30 6*6=36
1*7=7 2*7=14 3*7=21 4*7=28 5*7=35 6*7=42 7*7=49
1*8=8 2*8=16 3*8=24 4*8=32 5*8=40 6*8=48 7*8=56 8*8=64
1*9=9 2*9=18 3*9=27 4*9=36 5*9=45 6*9=54 7*9=63 8*9=72 9*9=81
This question requires any given positive integer N, Output from 1*1 To N*N Part of the formula table .
Input format :
Input gives a positive integer on a line N(1≤N≤9).
Output format :
Output the lower triangle N*N Part of the formula table , The number to the right of the equal sign is 4 position 、 Align left .
sample input :
4
sample output :
1*1=1
1*2=2 2*2=4
1*3=3 2*3=6 3*3=9
1*4=4 2*4=8 3*4=12 4*4=16
analysis : The subject is very simple , Only loop nesting is needed to complete , There is a knowledge point here, which is to occupy four places , How to occupy the fourth place ,-4d Four digits after the number ,4d It's four digits in front of the number .
Code implementation :
#include<stdio.h>
int main()
{
int n=0;
scanf("%d",&n);
int i=0,j=0;
for(i=1;i<=n;i++){// Outer loop control line
for(j=1;j<=i;j++){// Inner loop control column
printf("%d*%d=%-4d",j,i,i*j);
}
printf("\n");
}
return 0;
}
Link to the original text :https://blog.csdn.net/zoroly/article/details/119768226
边栏推荐
- Leetcode (4) -- find the median of two positively ordered arrays
- js 2023. String pair equal to the target string after connection
- Raft 协议
- Comprehensive evaluation of good-looking, easy-to-use and powerful handwriting note taking software: notability, goodnotes, marginnote, handwriting, notes writers, collanote, collanote, prodrafts, not
- FPGA test method takes mentor tool as an example
- Sendmail无法发送邮件及发送过慢解决
- Common mixins
- Vite project commissioning
- Why are grass-roots colleges and universities with "soil and poverty" called "Northeast small Tsinghua"?
- [Jilin University] information sharing of postgraduate entrance examination and re examination
猜你喜欢
Example analysis of QT learning 18 login dialog box
Redis: operation command of string type data
Leetcode (4) - - trouver la médiane de deux tableaux ordonnés positifs
x86汇编语言-从实模式到保护模式 笔记
7-7 12-24 hour system
剑指 Offer 28. 对称的二叉树
7-10 calculate salary
Interface for querying IP home
Uio-66-cooh loaded bendamostine | hydroxyapatite (HA) coated MIL-53 (FE) nanoparticles | baicalin loaded manganese based metal organic skeleton material
Fabric. JS document
随机推荐
28:第三章:开发通行证服务:11:在配置文件中定义属性,然后在代码中去获取;
Doxorubicin loaded on metal organic framework MIL-88 DOX | folic acid modified uio-66-nh2 doxorubicin loaded [email
战略、战术(和 OKR)
Exercise 10-8 recursive implementation of sequential output of integers
Comprehensive evaluation of good-looking, easy-to-use and powerful handwriting note taking software: notability, goodnotes, marginnote, handwriting, notes writers, collanote, collanote, prodrafts, not
Too many files with unapproved license
GRPC的四种数据流以及案例
jvm-运行时数据区
消息订阅与发布
Eight sorts
Understanding of closures
28: Chapter 3: develop Passport Service: 11: define attributes in the configuration file, and then obtain them in the code;
LNMP环境mail函数不能发送邮件解决
JS matrix zero
fpga阻塞赋值和非阻塞赋值
Common mixins
FPGA测试方法以Mentor工具为例
Selenium browser (1)
Raft 协议
Redis: commandes d'action pour les données de type chaîne