杭电acm1323
http://acm.hdu.edu.cn/showproblem.php?pid=1323
同UVA382
View Code
1 #include<stdio.h> 2 int main() 3 { 4 int a,i,sum; 5 printf("PERFECTION OUTPUT\n"); 6 while(scanf("%d",&a)&&a) 7 { 8 sum=0; 9 for(i=1;i<=a/2;i++) 10 if(a%i==0) 11 sum+=i; 12 if(sum==a) 13 printf("%5d PERFECT\n",a); 14 else if(sum<a) 15 printf("%5d DEFICIENT\n",a); 16 else printf("%5d ABUNDANT\n",a); 17 } 18 printf("END OF OUTPUT\n"); 19 return 0; 20 }