C#小白学习笔记(10)循环结构

    class Program
    {
        static void Main(string[] args)
        {
            int i = 1;
            do
            {
                Console.WriteLine(i);
                i++;
            } while (i<=10); //先执行do,再判断while中的条件

            for (int j = 15; j >= 11; j--) 
            {
                Console.WriteLine(j);
            }

            string str = "Hello";
            char[] ch = str.ToCharArray();
            foreach (char c in ch)
            {
                Console.WriteLine(c);
            }                                                                                                                                  
            Console.ReadKey();
        }
    }

运行结果:

 

posted @ 2020-09-17 14:46  ___lucky  阅读(88)  评论(0)    收藏  举报