Question: Extra#1 Perfect number (due 11/1) Part a) (do not submit this part Write a program to ask the user to enter an integer from 1

Extra#1 Perfect number (due 11/1)

Part a) (do not submit this part

Write a program to ask the user to enter an integer from 1 to 100 (validate user's input), and display the number together with all of its factors (except the number itself) and the sum of the factors. If the sum of the factors equals the number display <= is a PERFECT NUMBER (see below)

Sample RUN

Enter an integer from 1 to 100: 24

The factors of 24 are: 1, 2, 3, 4, 6, 8, 12 with a sum of 36

Sample RUN

Enter an integer from 1 to 100: 6

The factors of 6 are: 1, 2, 3 with a sum of 6 <= is a PERFECT NUMBER

Part b) (submit this part only)

Expand part a) to check all integers from 1 to 500 to display all the perfect numbers (there are a total of 3).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!