So for my assignment, I have to write a program that asks the user for an integer input and then print out that number\'s prime factorization. This is what I have:
you can also get some help from the below function.
public int getPrimeNumber(double number) {
int j = 0;
while (number % 2 == 0) {
number = number / 2;
j = 2;
}
for (int i = 3; i <= number; i = i + 2) {
while (number % i == 0) {
number = number / i;
j = i;
}
}
return j == 0 ? 1 : j;
}
This function will return the largest prime factor of the given number.