凌愉晴 • 2个月前
#include<bits/stdc++.h>
using namespace std;
int main()
{
for(long long i = 1; i <= 9; i++) {
for (long long j = 1; j <= i; j++) {
long long ans = i*j;
cout << j << "*" << i << "=" << ans;
if (ans < 10) {
cout << " ";
} else {
cout << " ";
}
}
cout << endl;
}
return 0;
}
Comments:
//太复杂了,不用longlong
#include<bits/stdc++.h>
using namespace std;
int main(){
for(int i=1;i<=9;i++){
for(int k=1;k<=i;k++){
cout<<k<<"*"<<i<<"="<<i*k;
printf(i*k<10?" ":" ");
}
cout<<endl;
}
}