c语言完数
怎么打不出496 只是打出前面两个#include <stdio.h>
int main()
{
int i, sum;
int t;
long int a[15];
int n, count;
for (sum = 6; sum < 500; sum++)
{
t = 0;
n = 0;
count = 0;
for (i = 1; i < sum; i++)
{
if (sum%i == 0)
{
a[n] = i;
t += a[n];
n++;
count++;
}
}
if (sum == t)
{
printf("%d=", sum);
for (n = 0; n < count; n++)
printf("%d+", a[n]);
printf("\b ");
printf("\n");
}
}
return 0;
}