码迷,mamicode.com
首页 > Windows程序 > 详细

C# 3循环 for语句应用

时间:2015-03-02 22:08:30      阅读:192      评论:0      收藏:0      [点我收藏+]

标签:

 

 

 

class 做图形

    {

        static void Main(string[] args)

        {

    //打印下列图形

            //★★★★★

            //★★★★★

            //★★★★★

            //★★★★★

            //★★★★★

             // 图(一)

 

       //     for (int i = 1; i <= 5; i++)

       //     {

       //         for (int j = 1; j <= 5; j++)

       //         {

       //             Console.Write("★");

                  

       //         }

       //       Console.Write("\n");

       //     }

             

       //     Console.ReadLine();

 

 

 

 

                                                //行   列

            //★                                //1    5

            //★★                              //2    4

            //★★★                            //3    3

            //★★★★                          //4    2

            //★★★★★                        //5    1

 

            ////图(二)

 

      //for (int i = 1; i <= 5; i++)                                                       //{                                                                 

            //    for (int j = 1; j <= i;j++ )                         

            //    {                                                 

            //        Console.Write("★");                           

            //    }

            //    Console.WriteLine("\n");

            //}

            //Console.ReadLine();

 

 

 

 

 

                                                              //      行  列

            //★★★★★                                     //       1    5             

            //★★★★                                       //       2    4

            //★★★                                         //       3    3              

            //★★                                           //       4    2                

            //★                                             //       5    1      

 

  

           //// 图(三)

 

            //for (int i = 1; i <= 5; i++)

            //{

            //    for (int j = i; j <= 5; j++)

            //    {

            //        Console.Write("★");

            //    }

            //    Console.Write("\n");

            //}

            //       Console.ReadLine();

 

 

 

 

           

            //☆☆☆☆★

            //☆☆☆★★

            //☆☆★★★

            //☆★★★★

            //★★★★★

 

 

             ////图(四)

 

 

            //for (int i = 1; i <= 5;i++ )

            //{

            //     for(int n =1 ;n<=5-i;n++)                          

                                        //for 循环里的小for循环是按照前后顺序单独进行的

            //    {                                                 

                                           //n的循环完全结束 然后进行m的循环的

            //        Console.Write("☆");

            //    }

            //    for (int m = 1; m <= i; m++)

            //    {

            //        Console.Write("★");

            //    }

              

            //    Console.Write("\n");

            //}

            //Console.ReadLine();

 

 

 

 

 

 

           

            //☆☆☆☆★

            //☆☆☆★★★

            //☆☆★★★★★

            //☆★★★★★★★

            //★★★★★★★★★

              ////图(五)

            // 分析 :行(5行)和列(9列有三种符号“☆”“★”“空格”),大for里面有三个小for,

            //for (int i = 1; i <= 5; i++)

            //{

            //    for (int a = 1; a <= 5 - i; a++)

            //    {

            //        Console.Write("☆");

            //    }

            //    for (int b = 1; b <= i; b++)

            //    {

            //        Console.Write("★");

            //    }

            //    for (int c = 1; c <= i - 1; c++)

            //    {

            //        Console.Write("★");

            //    }

            //    Console.Write("\n");

            //}

 

            //Console.ReadLine();

 

        }

 

 

    }

C# 3循环 for语句应用

标签:

原文地址:http://www.cnblogs.com/981971554nb/p/4309704.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!