c语言__5位数中每位相加的和等于每位乘机--算法2
程序员文章站
2022-03-22 08:07:29
...
#include<stdio.h>
int main(void)
{
int i1, i2, i3, i4, i5;
int n = 0;
for (i1 = 1; i1 <= 9;i1++)
for (i1 = 1; i1 <= 9; i1++)
for (i1 = 1; i1 <= 9; i1++)
for (i1 = 1; i1 <= 9; i1++)
for (i1 = 1; i1 <= 9; i1++)
{
if (i1*i2*i3*i4*i5 == i1 + i2 + i3 + i4 + i5)
{
n++;
printf("n=%d,%d%d%d%d%d\n", n, i1, i2, i3, i4, i5);
}
}
getchar();
return 0;
}
转载于:https://my.oschina.net/u/2314817/blog/375695