title: Calculating and printing the nth prime number
body: <p>I am trying to calculate prime numbers, which I've already done. But I want to calculate and print ONLY the nth prime number (User input), while calculating the rest (They won't be printed) only the nth prime number will be printed.</p>
  
  <p>Here's what I've written so far:</p>
  
  <pre><code>import java.util.Scanner;
  /**
   * Calculates the nth prime number
   * @author {Zyst}
   */
  public class Prime {
      public static void main(String[] args) {
  
          Scanner input = new Scanner(System.in);
          int n, 
              i = 2, 
              x = 2;
  
          System.out.printf("This program calculates the nth Prime number\n");
          System.out.printf("Please enter the nth prime number you want to find: ");
          n = input.nextInt();
  
          for(i = 2, x = 2; i &lt;= n; i++) {
              for(x = 2; x &lt; i; x++) {
                  if(i % x == 0) {
                      break;
                  }
              }
              if(x == i) {
                  System.out.printf("\n%d is prime", x);
              }
          }
      }
  }
  </code></pre>
  
  <p>This is the program I wrote to calculate the prime numbers from 1 to n. However, I want it to only print the nth prime number,</p>
  
  <p>What I've thought of doing is making some sort of count int and ++ing it every time it finds a prime, and when the count == n then it prints out that number, but I can't quite figure out how to land it.</p>