title: Java help! Trying to figure out how the for loop works
body: <pre><code>public static void main(String[] args) {
  
      // create new instance of random class
      Random rand = new Random();
      // set variable num to be a random number between 0 and 10
      int user = rand.nextInt(10);
      // set output equal to the result of our function
      int password = check_password(user);
      // print result
      System.out.println(password);
  
  }
  
  // returns the factorial of the given input- by what number i is 
  // i can be less than or equal to 10
      public static int check_password(int user) {
      int log = 1;
      for (int i = 1; i &lt;= user; i++) {
          log = log * i;
      }
      return log;
      }
  </code></pre>
  
  <p>I am confused on how the answer can be higher than 10, i don't understand how it can print answers when you run the code in eclipse: 
  40320
  120
  6
  5040
  24
  2
  1
  362880</p>
  
  <p>I am supposed to figure out what the code does and write it in the code in comments</p>