Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>you need to add elements to that array. the first loop gives you in the inner access to a variable i, the second for j, but to fill it I would first prefer a recursive way:</p> <p>create a method with variables for your array and an index (which location to fill next in the array). Then call the method with a new array and index = 0</p> <p>in the method 1. check if the index is already out of the array range. in that case print the array and exit the method 2. in all other cases, add a for loop from 0 to 30, and inside, add the current number to the location 'index' and call the method again, giving your array and index+1</p> <p>but i would try that method with less items first. May take a while to print all</p> <p>Here an example in vb.net language. You can not directly copy paste it, but it may help to understand how to create the combinations.</p> <pre><code>Private Sub AllCombinations(array() As Integer, index As Integer) If index &lt; 10 Then For i As Integer = 0 To 30 array(index) = i AllCombinations(array, index + 1) Next Else PrintMethod(array.ToString) End If End Sub Private Sub AllPermutations(array() As Integer, index As Integer, remaining As List(Of Integer)) If index &lt; 10 Then For Each ele In remaining array(index) = ele Dim newRemaining As New List(Of Integer) newRemaining.AddRange(remaining) newRemaining.Remove(ele) AllPermutations(array, index + 1, newRemaining) Next Else PrintMethod(array.ToString) End If End Sub </code></pre> <p>index 0..9 is t ofill array, if index is 10 then the array is full and we will only show it. Either we fill every slot with any number between 0 and 30, or you keep a list to memorize which numbers are still remaining (in the Permutations you need to fill the remaining list with all allowed numbers first!)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload