#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
usingnamespace std;
int main()
{
int sum= 0;
int Number;
int i = 2;
int countA;
int countB;
string runagain;
bool run = true;
bool prime = true;
bool perfect = false;
while (run == true)
{
cout << "Enter a number" << endl;
cin >> Number;
cout<<"The number you entered is: "<<Number<< endl;
// perfect
for(i = 1; i <= Number/2; ++i)
{
if((Number%i) == 0)
{
sum+=i;
}
if(sum==Number)
cout<< "The number you entered is a Perfect Number"<<endl;
else
cout<< "The number you entered is not a Perfect Number"<<endl;
// prime
for(i=2; i<Number; i++)
{
if ((Number%i)==0)
prime=false;
}
if (prime == true)
cout<< "The number you entered is a Prime Number"<<endl;
else
cout<< "The number you entered is not a Prime Number"<<endl;
// divisors
cout << "the divisors for " << Number << " are: " << endl;
for(i=1; i<Number; i++)
{
if(Number%i==0)
{
cout << i << "\t" ;
sum = sum + i;
}
}
// retry
cout << endl;
cout << "Would you like to test another integer? (Y/N)" << endl;
cin >> runagain;
if(runagain == "y" || runagain =="Y" || runagain == "Yes")
run = true;
else
run = false;
}
}
system ("pause");
return (0);
}