Menu

Must Be Done In Java Create A Program Which Prompts The User For A Number The Pr

Must be done in Java.

Create a program which prompts the user for a number.  The program then calculates the prime factors of that number USING RECURSION.  If you don’t use recursion in your program, you will not get credit.  

Your program should then output the prime factors in sorted order.  

For example, the prime factors for 6 are 2×3.  For 12,  2 is a prime factor, leaving 6 (2×6=12).  So, you could then determine the prime factors of 6, resulting in 2 and 3 as the prime factors. Thus, the factors are 2, 2, 3.  

This example also gives you a hint regarding a recursive algorithm.

Leave a Reply

Your email address will not be published. Required fields are marked *