2009-01-10 20:50:12來源不明
ACM 382 Perfection
簡單的求因數問題!
/***********************************************************/
- #include<stdio.h>
- #include<stdlib.h>
- #include<string.h>
- main()
- {
- int a,temp,x,y;
- printf("PERFECTION OUTPUT\n");
- while(scanf("%d",&x)==1&&x!=0)
- { temp=0;
- for(a=1;a<x;a++)
- {
- if(x%a==0)
- temp=temp+a;
- }
- if(temp==x) printf("%5d PERFECT\n",x);
- if(temp<x) printf("%5d DEFICIENT\n",x);
- if(temp>x) printf("%5d ABUNDANT\n",x);
- }
- printf("END OF OUTPUT\n");
- return 0;
- }