Question: java1 Write a Java program that reads two positive integers numi and num2 (assume numinum2). Then, the program will display all perfect numbers between num1
Write a Java program that reads two positive integers numi and num2 (assume numinum2). Then, the program will display all perfect numbers between num1 and num2. A positive integer is called a perfect number if it is equal to the sum of all of its positive divisors, excluding itself. For example, 6 is the first perfect number because 6-3+2+1 The next is 28 = 14 +7+4+2+ 1. Hint: use modulus (%) to find the divisor of a number Sample Input/Output Input the 2 numbers: 6 1001 Perfect Numbers are: 6 28 496 Note: Your answer should follow the given sample input/output
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
