Ejemplo n.º 1
0
        public static void Main()
        {
            var loopsCount = int.Parse(Console.ReadLine());
            var numbers    = Enumerable.Range(0, loopsCount).Select(x => 1).ToArray();

            NestedLoops.LoopWrite(numbers, loopsCount, loopsCount);
        }
Ejemplo n.º 2
0
        private static void LoopWrite(int[] range, int current, int count)
        {
            for (int i = 0; i < count; i++)
            {
                if (current > 1)
                {
                    NestedLoops.LoopWrite(range, current - 1, count);
                }
                else
                {
                    Console.WriteLine(string.Join(" ", range));
                }

                range[count - current]++;
            }

            range[count - current] = 1;
        }