题解 | #打印乘法表#
打印乘法表
https://www.nowcoder.com/practice/4c1ec287030d4ca1be63b258f88ebcc1
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
//i表示乘法表行数.
for (int i = 1; i <= n; i++) {
//j表示乘法表列数
for (int j = 1; j <= i; j++) {
//按对应格式输出乘法表
cout << j << " * " << i << " = " << j* i << " ";
}
//每打印完一行,进行换行
cout << endl;
}
return 0;
}
