title: java program to find prime factors of a number
body: <pre><code>public class PrimeFactor {
  
  public static void main(String[] args) {
      Scanner input = new Scanner(System.in);
      System.out.println("Enter the number:");
      int num=input.nextInt();
      int factors;
      for(int i=1;i&lt;num;i++)
      {
          factors=num%i;
          if(factors==0 &amp;&amp; isPrime(factors))
          System.out.println(i+"");
      }
      input.close();
  }
  public static boolean isPrime(int n)
  {
      boolean prime=true;
      for(int i=2;i&lt;n;i++)
      {
          if(n%i==0)
          {
              prime=false;
              break;
          }
  
      }
      return prime;
  }
  
  }
  </code></pre>
  
  <p>I have written this code to find the prime factors of a number. The logic I have applied seems fine to me but the output is coming wrong. </p>