import java.util.Scanner;
class Perfect
{
int n;
//To initialize values
Perfect(int no)
{
n=no;
}
//To check whether a given number is perfect or not
void check()
{
int i,s=0;
for(i=1;i<n;i++)
{
if(n%i==0)
{
s=s+i;
}
}
if(s==n)
System.out.println(n+" is Perfect.");
else
System.out.println(n+" is not Perfect.");
}
}
//To create object
class TestPerfect
{
public static void main(String args[])
{
int n;
Scanner input=new Scanner(System.in);
system.out.println("\nEnter number :- ");
n=input.nextInt();
Perfect obj=new Perfect(n);
obj.check();
}
}
0 Comments