the programe output the sum of the factor of a number
entered by user and when he enter 0 the programe should display output with no result for 0
here is the code
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
int x,i;
int z=1;
int sum=0;
while(cin>>x)
{
if(x!=0)
{
for(int i=1;i<x;i++)
{
if(x%i==0)
{
z=i;
}
if(x%i!=0)
{
continue;
}
sum+=z;
}
}
if(x==0)
{
break;
}
}
cout<<"PERFECTION"<<" "<<"OUTPUT"<<endl;
if(sum==x)
{
cout<<setw(5)<<x<<" "<<"PERFECT"<<endl;
}
else if(sum>x)
{
cout<<setw(5)<<x<<" "<<"DEFICIENT"<<endl;
}
else if(sum<x)
{
cout<<setw(5)<<x<<" "<<"ABUNDANT"<<endl;
}
cout<<"END OF OUTPUT"<<endl;
return 0;
}