public class PrimeFactor{ public void printPrimeFactors(long num) { long i=1,j,k; while(i<=num) { k=0; if(num%i == 0) { j=1; while(j<=i) { if(i%j==0) k++; j++; } if(k==2) System.out.println("Prime factor is : "+i); } i++; } } }
public class PrimeFactor{ public void printPrimeFactors(long num) { long i=1,j,k; while(i<=num) { k=0; if(num%i == 0) { j=1; while(j<=i) { if(i%j==0) k++; j++; } if(k==2) System.out.println("Prime factor is : "+i); } i++; } } }
0 Comments