Question: Write a program that prompts the user to enter a positive integer which is greater than one and displays all its smallest factors in

Write a program that prompts the user to enter a positive integer  

Write a program that prompts the user to enter a positive integer which is greater than one and displays all its smallest factors in decreasing order. For example, if the integer is 140, the smallest factors are displayed as 7, 5, 2, 2. Use the StackOfintegers class to store the factors (e.g., 2, 2, 5, 7) and retrieve and display them in reverse order. After that, write a program that displays all the prime numbers less than the number - which is used in the prime factors (e.g: 140)- in decreasing order. Use the StackOfintegers class to store the prime numbers (e.g., 2, 3, 5,...) and retrieve and display them in reverse order. Here is the sample runs: To use the prime factors you must enter a positive integer which is greater than one: 140 7522 Printing prime numbers under 140: 139 137 131 127 113 109 107 103 101 97 89 83 79 73 71 67 61 59 53 47 43 41 37 31 29 23 19 17 13 11 7 5 32

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

include include include usingnamespacestd classStackOfIntegers priv... View full answer

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 Operating System Questions!