Problem Type : Ad Hoc
#include<stdio.h>
int main()
{
long int a,n,i,sum;
printf("PERFECTION OUTPUT\n");
while(scanf("%ld",&n)==1)
{
if(n==0)
break;
sum=0;
for(i=1; i<n; i++)
{
if(n%i==0)
{
sum=sum+i;
}
}
if(sum==n)
{
printf("%5ld PERFECT\n",n);
}
else if(sum>n)
{
printf("%5ld ABUNDANT\n",n);
}
else if(sum<n)
{
printf("%5ld DEFICIENT\n",n);
}
}
printf("END OF OUTPUT\n");
}
No comments:
Post a Comment