2025-03-06 22:46:33 +08:00

25 lines
462 B
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*-------------------------------------------------------
编程输出1000以内的完数所谓完数是指一个数的所有因子包含1但不包含其本身之和等于这个数本身。28=1+2+4+7+14
-------------------------------------------------------*/
#include <stdio.h>
main()
{
int i,j,s;
for(i=2;i<=1000;i++)
{
s=0;
/**********Program**********/
for(j=1;j<i;j++){
if(i%j==0){
s+=j;
}
}
/********** End **********/
if(s==i)
printf("%d\n",i);
}
}