Algorithmus alle Möglichkeiten Lotto?

3 Antworten

Ich denke mal, sowas in der Art könnte gemeint sein:

public static int[][] lotto()
{
    int[][] result = new int[13983816][];

    int counter = 0;

    for (int a = 1; a <= 44; ++a)
    {
        for (int b = a+1; b <= 45; ++b)
        {
            for (int c = b+1; c <= 46; ++c)
            {
                for (int d = c+1; d <= 47; ++d)
                {
                    for (int e = d+1; e <= 48; ++e)
                    {
                        for (int f = e+1; f <= 49; ++f)
                        {
                            result[counter++] = new int[] { a, b, c, d, e, f};
                        }
                    }
                }
            }
        }
    }

    return result;
}

Würde dir zwar gerne helfen, aber habe keinen Plan, was diese komische Skizze bedeuten soll.

Hast du die Aufgabe eventuell auch in Textform, oder kannst was dazu erklären oder etwas Kontext?

Woher ich das weiß:Studium / Ausbildung – Bachelor in Informatik 👨🏻‍🎓