I have the problem that I've got 6 for-loops but I want to remove the loops and replace them with a recursive/dynamic method.. sadly I dont have a clue how I can do this. Maybe one of you can help me.
for (int a = 1; a < 45; a++)
{
for (int b = a + 1; b < 46; b++)
{
for (int c = b + 1; c < 47; c++)
{
for (int d = c + 1; d < 48; d++)
{
for (int e = d + 1; e < 49; e++)
{
for (int f = e + 1; f < 50; f++)
{
counter++;
new_counter = zaehler.ToString("N0");
Console.WriteLine(a + " " + b + " " + c + " " + d + " " + e + " " + f + " | -> " + new_counter);
if (zaehler == 13983816)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine($"{new_counter} combinations.");
Console.ReadKey();
}
}
}
}
}
}
}