Question: C++ programming language 5. Write a program that requests an integer and displays: - all factors of the input (numbers that evenly divide the input)
C++ programming language
5. Write a program that requests an integer and displays: - all factors of the input (numbers that evenly divide the input) (i.e. 1,2,3,5,6,10,15 are all factors of 30) - if the input is prime (input that is only divisible by 1 and itself) a) Request an integer value between 1 and 100 (exclusive). b) Use a validation loop to insure that the input: - is an integer - is within the specified range c) Display all factors of the value. d) Indicate if the number is prime. Output Example (input value is not prime): Enter an integer between 1 and 100: 5.3 Invalid value. Enter an integer between 1 and 100: 103 Invalid value. Enter an integer between 1 and 100: 56 Factors of 56: 1 2 4 7 8 14 28 56 Output Example (input value is prime): Enter an integer between 1 and 100: 5 Factors of 5: 1 5 5 is a prime number.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
