#include <stdio.h>
int main() {
int i = 0;//初始化
for (i = 10000; i <= 99999; i++)//范围
{
int a1 = i / 10000;//千
int a2 = i % 10000;
int a3 = a1 * a2;
int b1 = i / 1000;//百
int b2 = i % 1000;
int b3 = b1 * b2;
int c1 = i / 100;//十
int c2 = i % 100;
int c3 = c1 * c2;
int d1 = i / 10;//个
int d2 = i % 10;
int d3 = d1 * d2;
int sum = a3 + b3 + c3 + d3;
if (sum == i)//判断
{
printf("%d ", i);
}
}
return 0;
}

京公网安备 11010502036488号