一:利用双层for循环嵌套实现
#include <iostream>
int main() {
//外层设置变量z
for (int z = 1; z <= 9; z++) {
//内层设置变量y
for (int y = 1; y <= z; y++) {
//打印输出
cout << y << "x" << z << "=" << (z * y)<<" ";
}
//换行
cout<< "\n" << endl;
}
system("pause");
return 0;
}