Hi guys... i need some help getting the following code to display how many prime factors there are for a number (in this case the number is represented by a) and also the largest prime factor of that same number. At the moment, it displays all of the prime factors. Any help would be great.

Code:for(p1 = 1; p1 <= a; p1++) { for(p2 = (a / 2); p2 > 0; p2--) { if (p1 * p2 == a) { cout << p2 << endl; } } }