Question: Write a Java program that reads two positive integers num1 and num2 (assume num1 < num2). Then, the pro will display all perfect numbers
Write a Java program that reads two positive integers num1 and num2 (assume num1 < num2). Then, the pro will display all perfect numbers between num1 and num2. A positive integer is called a perfect number if it is eq 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 Enter two numbers: 6 1001 6 is a perfect number 28 is a perfect number 496 is a perfect number 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
