So i have this code ("this is the correct form")
and i have this one("this is what i did ,its look almost exectly like the first one exept i didnt install int j")public static String buildPrimeNumbers(int num){ String sum="";int j=num; for (int i=2;i<=(j/2);i++){ while (num%i==0) {sum+=i+" "; num=num/i;} } return sum;}
public static String buildPrimeNumbers(int num){ String sum=""; for (int i=2;i<=(num/2);i++){ while (num%i==0) {sum+=i+" "; num=num/i;} } return sum;}
my question is my is my code doesn't give me the exact prime numbers as the correct one.
what is the matter between if i put (i<=(num/2)) or (i<=j/2) .while j==num?