title: Solving a difficult equation with two variables in Java
body: <p>My assignment says to do the following:<br>
  Search2: Search for a solution to x*x + y*y - 12x -10y + 36 = 0. Search from 0 to 10 in both x and y, searching every y value before moving to the next x. Print the first three solutions found. (Note - a labelled break is handy here!)  </p>
  
  <p>I can't figure out the logic for this. I think I have to use more than 2 loops but not sure.<br>
  This is what I have so far (It just repeats (6,0)):  </p>
  
  <pre><code>for (int j = 0; j &lt;= 10; j++) {
      for (int i = 0; i &lt;= 10; i++) {
          while (((i * i) + (j * j) - (12 * i) - (10 * j) + 36) == 0) {
              System.out.println("(" + i + ", " + j + ")");  
          }  
      }  
  }  
  </code></pre>
  
  <p>UPDATE<br>
  Here is the solution:  </p>
  
  <pre><code>    int t = 0;
  
      for (int i = 0; i &lt;= 10; i++) {
          if (t == 3) {
              break;
          }
          for (int j = 0; j &lt;= 10; j++) {
              if (((i * i) + (j * j) - (12 * i) - (10 * j) + 36) == 0) {
                  System.out.println("(" + i + ", " + j + ")");
                  t++;
              }
          }
      }
  </code></pre>