C#的金字塔图形和九九乘法表

1.今天尝试写了一下金字塔的图形,用了三个for循环。for example:

public Class Test
{
     public void UpToFor()
   {
             for(int i=0;i<9;i++)
        {
              for(for int j=i;j<8;j++)
               {
                    Console.Write(" ");
               }
             for(int z=0;z<=2*i;z++)
              {
                     Console.Write("*");
              }
            Console.WriteLine();
        }
       Console.ReadKey();
   }
        static void Main(string[] args)
    {
             UpToFor();
    }
}

2.用C#写一个九九乘法表
 1 public  Class Ninth
 2 {
 3        static void Main(string[] args)
 4       {
 5                 for(int i=1;i<=9;i++)
 6                {
 7                     for(int j=1;j<=i;j++)
 8                       {
 9                             Console.Write("{0}*{1}={2}",i,j,i*j);
10                        }
11                      Console.WriteLine();
12                }
13             Console.ReadKey();
14       } 
15 }


 

  

sometimes the hardest part isn't letting go,but rather start over
原文地址:https://www.cnblogs.com/zhumeiming/p/4373968.html