#include<iostream>
using namespace std;
int main() {
int j; int i;
int k;
int a[100][100]={0};
for (i = 1; i<10; i++)
a[i][0]=i;
for (j = 1; j<10; j++)
a[0][j]=j ;
for (i = 1; i < 10;i++) {
for (j = 1; j < 10;j++) {
a[i][j] = a[i][0]*a[0][j];
k= a[i][j];
if (a[i][j]>9)
a[i][j] = k / 10 + k % 10;
if (a[i][j] > 9){
k = a[i][j];
a[i][j] = k / 10 + k % 10;
}
}
}
for (i = 0; i<10; i ++) {
for (j = 0; j < 10; j++)
if (j ==9)
cout << a[i][j] << endl;
else
cout << a[i][j] ;
}
int h;
cin>>h;
for (i = 1; i<10; i ++) {
for (j = 1; j < 10; j++)
if (h==a[i][j])
cout << ‘*‘ ;
else
cout <<‘ ‘ ;
cout<<‘\n‘;
}
return 0;
}
时间: 2024-12-31 03:53:20