class PerfectNumber{ public static void main(String args[]){ int Number=0; int Sum_Of_Divisors=0; try{// if the user does not enter a number as an argument, catch the error and let the user know what the error is. //it is better because the error generated by the compiler could be hard to understand by the users who do not know about the code Number=Integer.parseInt(args[0]); }catch(Exception e){ System.out.println("Please give a number as an argument"); System.exit(0); } System.out.println("Number Entered is "+Number); Sum_Of_Divisors=Get_Sum_Divisors(Number);// call the function which gives the sum of positive divisors of the number entered // Depending upon the sum returned print the appropriate message if(Sum_Of_Divisors==Number) System.out.println("Number "+Number+" is a Perfect Number"); else if(Sum_Of_Divisors < Number) System.out.println("Number "+Number+" is a Deficient Number"); else System.out.println("Number "+Number+" is an Abundant Number"); } //This method returns the sum of divisors of the number passed public static int Get_Sum_Divisors(int number){ int temp_sum=0; for(int i=1;i