title: For loop in prime factorization calculator displays composite numbers as well as the loop does not restart
body: <p>When the for loop detects a number that is less than the positive integer inputted by the user and perfectly divisible, it prints it and that is because the for loop just continues counting through each number. However, I need it to prime factorize the positive integer inputted by the user. </p>
  
  <pre><code>import java.util.Scanner;
  public class PrimeFactor {
  
      public static void main(String[] args) {
          Scanner console = new Scanner(System.in);
  
          System.out.print("Enter a positive integer: ");
          int Number = console.nextInt();
  
          for (int counter =2; counter &lt; Number; counter++) {
              if (Number % counter ==  0) {
                  System.out.print(" "+counter);
              }
  
          }
  
      }
  
  }
  </code></pre>