Given a positive integer N as the input,
the program must print yes if N is a perfect number. Else no must be printed.
Input
Format:
The first line contains N.
Output
Format:
The first line contains yes or no
Boundary
Conditions:
1 <= N <= 999999
Example
Input/Output 1:
Input:
6
Output:
yes
Example
Input/Output 2:
Input:
8
Output:
no
Solution
1:
n,s,i=int(input()),1,2
while i*i<=n:
if n%i==0:
s+=i+n/i
i+=1
print('yes') if n==s else print('no')
Solution
2:
#include <iostream>
using namespace std;
int main()
{
int
i,n,s=1;
cin>>n;
for(i=2;i*i<=n;i++)
if(n%i==0)
s+=i+n/i;
s==n?cout<<"yes":cout<<"no";
}