Question: I need help with this problem: This program will output the factors of user specified positive integer. (1) The program will prompt the user for

I need help with this problem:

This program will output the factors of user specified positive integer.

(1) The program will prompt the user for a positive integer. If the user inputs a non-positive integer (0 or negative), the program will re-prompt the user using a loop until a positive integer is input.

(2) The program will print a list of all factors (divisors) of the given positive integer in ascending order. The program will then print a message stating whether the number is composite (has factors other than 1 and itself) or prime (only has factors of 1 and itself).

Example:

Please enter a positive integer: -3 Please enter a positive integer: 0 Please enter a positive integer: 15 Factors of 15 are: 1 3 5 15 15 is a composite number. 

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!