Question: I'm having trouble making a code for this problem, my class is working with java in while loops and for loops. Write a method that
I'm having trouble making a code for this problem, my class is working with java in while loops and for loops.
Write a method that returns true if an integer parameter n is a perfect number, false otherwise. (recall a perfect number is a number whose sum of its proper factors is equal to itself) (Precondition: n >= 1 .. means you are to presume n is positive) : EXAMPLE: 6 is a perfect number 1 2 3 equals 6 :EXAMPLE: 8 is not a perfect number... 1 2 + 4 does not equal 8 isPerfect(6) true isPerfect(8) false isPerfect(16) - false Go ..Save, Compile, Run (ctrl-enter) public boolean isPerfect(int n)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
