#include <iostream>
using namespace std;
int main() {
int num =0,sum=0;
cin>>num;
for(int number=1;number<=num;number++)
{
sum=0;
for(int i=1;i<number;i++)
{
if(num%i==0)
{
sum = sum+i;
}
}
if(sum == number)
{
cout<<number<<"is a perfect num"<<endl;
}
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: