#1
10.04.2021 um 14:16 UhrHallo, mir ist leider unklar, was das mit der Aufgabenstellung zu tun hat.

C# :: Aufgabe #349 :: Lösung #2
using System; using System.Collections.Generic; namespace FaireWuerfel { class Program { static void Main(string[] args) { List<Combination> list = new List<Combination>(); for (int a = 1; a < 5; a++) { for (int b = 2; b < 6; b++) { for (int c = 3; c < 7; c++) { if (a == b || a == c || b == c || c < b || b < a) continue; list.Add(new Combination(a, b, c)); } } } foreach (Combination combination in list) { Console.WriteLine($"A = {combination.A}, B = {combination.B}, C = {combination.C}"); } Console.WriteLine($"Anzahl der Kombinationen: {list.Count}"); } } public class Combination { public Combination(int a, int b, int c) { this.A = a; this.B = b; this.C = c; } public int A { get; set; } public int B { get; set; } public int C { get; set; } } }
Kommentare:
hollst
Punkte: 13980
761 Aufgaben
132 Lösungen
117 Kommentare