Write your own code
A number n is a perfect number if its factors, including 1, but not including the number itself,
sum to n. For example, 6 is a perfect number, because the factors of 6 (not including 6) are 1, 2
and 3, and 1 + 2 + 3 = 6. 28 is also a perfect number, because 1 + 2 + 4 + 7 + 14 = 28.
Write code to print out all of the perfect numbers between two values entered by the user, where the first number entered is the starting point of the range, and the second number entered is the
ending point of the range. Your code should check to make sure that the numbers entered by th
user are strictly positive, and that the second number is larger than the first number. You may
assume the user enters integer values. After printing all of the perfect numbers between (and
including) the values entered by the user, your code should either print out “No perfect numbers
in range” or a message indicating the quantity of perfect numbers that were in the range. Note
that the word printed in the final message is either “number” or “numbers” depending on
whether 1 or more perfect numbers were found, but the line listing the perfect numbers always
says “Perfect numbers are:”
Write your own code
A number n is a perfect number if its factors, including 1, but not including the number itself,
sum to n. For example, 6 is a perfect number, because the factors of 6 (not including 6) are 1, 2
and 3, and 1 + 2 + 3 = 6. 28 is also a perfect number, because 1 + 2 + 4 + 7 + 14 = 28.
Write code to print out all of the perfect numbers between two values entered by the user, where the first number entered is the starting point of the range, and the second number entered is the
ending point of the range. Your code should check to make sure that the numbers entered by the user are strictly positive, and that the second number is larger than the first number. You may
assume the user enters integer values. After printing all of the perfect numbers between (and
including) the values entered by the user, your code should either print out “No perfect numbers
in range” or a message indicating the quantity of perfect numbers that were in the range. Note
that the word printed in the final message is either “number” or “numbers” depending on
whether 1 or more perfect numbers were found, but the line listing the perfect numbers always
says “Perfect numbers are:”