解题思路:
通过式子求出各位上的数字,再通过判断输出符合的答案。
注意事项:
参考代码:
#include<stdio.h>
int main()
{
int x,a,b,c,d;
for(x=1000;x<10000;x++)
{
a=x/1000; //千位
b=x/100%10; //百位
c=x/10%10; //十位
d=x%10; //个位
if(a+b+c+d==10)
printf("%d\n",x);
}
return 0;
}
0.0分
1 人评分