title: Printing Dice Combinations in Java
body: <p>For a project, I need to find a way to print every way to roll 5 6 sided dice, order non-important. I have tried using nested for loops like so, but I understand that this is printing permutations instead of combinations:</p>
  <pre><code>int counter = 0;
          for(int i=1; i&lt;7; i++) {
              
              for(int m = 1; m&lt;7; m++) {
                  
                  for(int j = 1; j&lt;7; j++) {
                      
                      for(int k = 1; k&lt;7; k++) {
                          
                          for(int h = 1; h&lt;5; h++) {
                              System.out.printf(&quot;%2d%2d%2d%2d%2d&quot;,i,m,j,k,h);
                              counter++;
                              System.out.println(&quot; &quot;+counter);
                          }
                      }
                  }
              }
          }
  </code></pre>
  <p>Is there an efficient way to do this?</p>
  <p>Edit: I should add, this is for java! Thanks!</p>
  <p>Edit again: yes, I meant 5 dice that each have 6 sides. Sorry for the confusion</p>