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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started