title: Find the Max/Min of values within a for loop
body: <p>I've searched for answers to this specific question, but haven't been able to find anything. I need to find the maximum and minimum of the input numbers but the values I need are inside the for loop and I can't figure out how to use them outside of it.</p>
  
  <pre><code>System.out.print("How many numbers do you want to input?");
  
      int totalNumbers = console.nextInt();
  
      int minMax = 0;
      for(int i = 1; i &lt;= totalNumbers; i++){
          System.out.print("Number " + i + ": ");
          int inputNumbers = console.nextInt();
      }
      System.out.println();
  
      int smallest = Math.min(minMax);
      System.out.println("Smallest = " + smallest);
      int largest = Math.max(minMax); 
      System.out.println("Largest = " + largest);
  </code></pre>
  
  <p>I don't need changed code just something that will get me on the right track.Thank you!</p>