题解 | #打印乘法表#
打印乘法表
https://www.nowcoder.com/practice/4c1ec287030d4ca1be63b258f88ebcc1
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
// 打印乘法表,两层循环,外层表示行,内层表示列
for(int i=1; i <= n; i++){
for(int j=1; j <= i; j++)
cout << j << " * " << i << " = " << j*i << " "; //4个空格,如果题目没要求可用制表符\t
cout << endl;
}
return 0;
}
#零基础学习C++##你的秋招进展怎么样了##我的2023新年愿望#