#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
long long n,i,j,sum;
sum=0;
cout<<"PERFECTION OUTPUT"<<endl;
while(cin>>n)
{
if(n==0) break;
if(n==1){
cout<<setw(5)<<n<<" "<<"DEFICIENT"<<endl;
}
else{
for(i=2; i<n-1; i++)
{
if(n%i==0) sum+=i;
}
if(sum+1==n) cout<<setw(5)<<n<<" "<<"PERFECT"<<endl;
else if(sum+1>n) cout<<setw(5)<<n<<" "<<"ABUNDANT"<<endl;
else if(sum+1<n) cout<<setw(5)<<n<<" "<<"DEFICIENT"<<endl;
}
sum =0;
}
cout<<"END OF OUTPUT"<<endl;
return 0;
}
#include<iomanip>
using namespace std;
int main()
{
long long n,i,j,sum;
sum=0;
cout<<"PERFECTION OUTPUT"<<endl;
while(cin>>n)
{
if(n==0) break;
if(n==1){
cout<<setw(5)<<n<<" "<<"DEFICIENT"<<endl;
}
else{
for(i=2; i<n-1; i++)
{
if(n%i==0) sum+=i;
}
if(sum+1==n) cout<<setw(5)<<n<<" "<<"PERFECT"<<endl;
else if(sum+1>n) cout<<setw(5)<<n<<" "<<"ABUNDANT"<<endl;
else if(sum+1<n) cout<<setw(5)<<n<<" "<<"DEFICIENT"<<endl;
}
sum =0;
}
cout<<"END OF OUTPUT"<<endl;
return 0;
}
No comments:
Post a Comment
Thank you for commenting. Please wait for response :)