Program:
// Program By http://solutionscpp.blogspot.com
// Author Mansoor Ahmed
// GMail ID: secguy000@gmail.com
#include<iostream>
using namespace std;
int main()
{
int n=0, sum=0;
cout<<"Enter Number: ";
cin>>n;
for(int i=1; i<n; i++)
{
if(n%i==0)
{
sum=sum+i;
}
}
if(sum==n)
cout<<"Entered Number is a Perfect Number" <<endl;
else
cout<<"Enter Number is Not a Perfect Number" <<endl;
}
0 comments: