It would help a LOT if you would insert comments (with the steps from that algorithm) into your code, so that you can see what is done and where.
Something like that:
Code:
// positive integer I is given
void factor(int I) {
// P = 1
int P = 1;
int mult;
// while (I > 1)
while (I > 1) {
// P = P + 1
P = P+1;
// what is this ...



