用C# 实现正三角 倒三角 和乘法九九表

1.正三角:

namespace zhengsanjiao

{

   class Program

  {

    static void Main(string []arges) 

        {

          for(int a=0;a<=10;a++)     //行数

          {

            for(int b=0;b<=a;b++)   //个数

              Console.Write(b);

              Console.WriteLine();

              }

         }

   }

}

2.倒三角:

namespace daosanjiao

{

    class Program

    {

          static void Main(string[]arges)

         {

               for(int a=10;a>=1;a--)

               {

                for(int b=1;b<=a;b++)

                   Console.Write(b);

                   Console.WriteLine();

               }

         }

      }

}

3.乘法九九表:

namespace chengfajiujiubiao

{

      class program

     {

        static void Main(string[]arges)

       {

      for(int a=1;a<=9;a++)

        {

          for(int b =1;b<=a;b++)

                           {

          Console.Write("{0}*{1}={2}",a,b,a*b);

                            }

                             Console.WriteLine();

                      }

     }

     }

 

}

posted on 2016-09-16 08:15  CHTZ  阅读(2942)  评论(0编辑  收藏  举报

导航