Pages

Thursday, October 22, 2009

UVA Problem#382

Question:

Solution: 
void perfection(int n){
int i , sum=0, m=n/2; 
for(i=1; i<=m; i++){ 
if(n%i==0)
sum += i; 
}
if(n>sum){ 
printf("DEFICIENT\n"); 
}
else if(n<sum){ 
printf("ABUNDANT\n"); 
}
else if(n == sum){
printf("PERFECT\n"); 
}
  int main(){
....
.... 
}  

No comments:

Post a Comment