打印三角形

方法1:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
           for (int i = 1; i <= 10; i++)
            {
                for (int t = 1; t <= i;t++ )
                {
                    Console.Write("");
                }
                Console.Write("\n");
                
                    
            }
          
            Console.ReadLine();
        }
    }
}

方法2:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string a = "";
              string b = "";
              for (int i = 1; i <= 10; i++)
              {
                  a = a + b;
                  Console.Write(a);
                  Console.Write("\n");
              }
              Console.ReadLine();
        }
    }
}

 

posted @ 2015-06-18 16:03  蓝瑟黄昏  阅读(128)  评论(0编辑  收藏  举报