zoukankan      html  css  js  c++  java
  • C# 3循环 for语句应用

     

     

     

    class 做图形

        {

            static void Main(string[] args)

            {

        //打印下列图形

                //★★★★★

                //★★★★★

                //★★★★★

                //★★★★★

                //★★★★★

                 // 图(一)

     

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

           //     {

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

           //         {

           //             Console.Write("★");

                      

           //         }

           //       Console.Write(" ");

           //     }

                 

           //     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(" ");

                //}

                //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(" ");

                //}

                //       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(" ");

                //}

                //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(" ");

                //}

     

                //Console.ReadLine();

     

            }

     

     

        }

  • 相关阅读:
    后缀数组 POJ 3693 Maximum repetition substring
    后缀数组 POJ 2406 Power Strings
    后缀数组 SPOJ 694 Distinct Substrings
    后缀数组 POJ 3261 Milk Patterns
    后缀数组 POJ 1743 Musical Theme
    后缀数组 POJ 3974 Palindrome && URAL 1297 Palindrome
    后缀数组 POJ 2217 Secretary
    Codeforces Round #349
    后缀数组 POJ 3581 Sequence
    Codeforces Round #348(VK Cup 2016
  • 原文地址:https://www.cnblogs.com/981971554nb/p/4309704.html
Copyright © 2011-2022 走看看