文章
145
粉丝
217
获赞
21
访问
81.9k
#include <stdio.h>
//完数判断
int Judge(int t[1000],int n,int *num)
{
int j,sum,i = 0;
sum=0;
for(j=1;j<n;j++)
{
if(n%j==0)
{
t[i++] = j;
sum+=j;
}
}
*num = i;
if(sum == n) return 1;
else return 0;
}
int main()
{
int i,n,a[1000],k;
scanf("%d",&n);
k = 0;
int t[1000] = {0},num = 0;
for(i = 2; i <= n; i++)
if(Judge(t,i,&num))
{
printf("%d its fastors are",i);
for(int h = 0; h < num; h++)
printf(" %d",t[h]);
printf("\n");
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发