题解 | 打印乘法表
#include <iostream>
using namespace std;
int main() {
int n,count=0;
cin >> n;
for (int i=1;i<=n;i++)
{
for (int j=1;j<=i;j++)
{
cout<<j<<" * "<<i<<" = "<<j*i<<" ";
count++;
if (count==i)
{cout<<endl;
count=0;
}
}
}
return 0;
}
查看23道真题和解析