#include<stdio.h>
int main()
{
int i,j,sum;
for (i= 2; i < 1000; i++) {
sum = 0;
for (j = 1; j < i; j++){
if (i%j == 0)
{
sum += j;}
}
if (sum == i)
{
printf("%d its factors are ", i);//factors表示因子
}
}
return 0;
}
main( )
{int i,k,j,s,a[20];
for(i=1;i<=1000;i++)
{s=1; //两个赋初值语句s=1,k=0
k=0; //一定要位于外部循环的内部
for(j=2;j<i;j++)
if (i % j 0)
{s=s+j; a[k]=j; k++;}
if(is)
{printf("%d it’s factors are :1",s);
for(j=0;j<k;j++)
printf(",%d", a[j]);
printf("\n"); }
} }