[PHP] Add all previous numbers in a for loop
#5

Until three, you can make them static, after that simple current number * 2;
Код:
            Console.WriteLine(1);
            Console.WriteLine(2);
            Console.WriteLine(3);
            var res = 3;
            for (int i = 0; i < 7; i++)
            {
                res *= 2;
                Console.WriteLine(res);
            }
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)