一个四位数分别与1,2,3,4,5,.19,20相乘,所得的积各个数位上数的和相同.请写出这个四位数.儿子四年级的作业,我一个也写不出来
问题描述:
一个四位数分别与1,2,3,4,5,.19,20相乘,所得的积各个数位上数的和相同.请写出这个四位数.
儿子四年级的作业,我一个也写不出来
答
1:0
2:99
3:198
4:297
5:396
6:495
7:594
8:693
9:792
10:990
11:999
12:1188
13:1485
14:1980
15:1998
16:2475
17:2970
18:2997
19:3960
20:3996
21:4950
22:4995
23:5940
24:5994
25:6930
26:6993
27:7920
28:7992
29:8991
30:9900
31:9990
32:9999
Press any key to continue
#include
sum(int x) {
int s = 0;
while(x) {
s += x % 10;
x /= 10;
}
return s;
}
void main() {
int x,y,s,n = 1;
for(x = 0; x s = sum(x);
for(y = 2; y