for循环练习

 

        static void Main(string[] arg)
        {
            int intSum = 0;
            for (int i = 0; i <= 100; i++)
            {
                intSum += i;
            }
            Console.WriteLine(intSum);
            Console.ReadKey();
        }

        static void Main(string[] arg)
        {
            for (int i = 0; i < 100; i++)
            {
                Console.WriteLine("我下次一定小心!");//打印"我下次一定小心"
            }
            Console.ReadKey();
        }
        static void Main(string[] arg)
        {
            int sum = 0;
            for (int i = 0; i < 100; i++)
            {
                if (i%2==0)
                {
                    sum += i;
                }
            }
            Console.WriteLine(sum);
            Console.ReadKey();
        }

 

posted @ 2024-08-12 12:28  CSF践行  阅读(5)  评论(0编辑  收藏  举报