如果整数A全部因子和等于B,整数B全部因子和等于A,则整数A与B为亲密数,求3000以内全部亲密数
#include <stdio.h>
#include <math.h>
#define max 1024
main()
{
int num;
int a[max];
int j;
int temp;
int i = 0;
int result = 0;
for(num = 2; num < 1000; num++)
{
temp = num;
while(temp != 0)
{
a[i] = temp % 10;
temp = temp / 10;
i++;
}
for(j = 0;j < i;j++ )
{
result = a[j] * a[j] * a[j] + result;
}
if(num == result)
{
printf("num = %d\n",num);
}
i = 0;
result = 0;
}
}