本帖最后由 zcy87710 于 2009-12-21 19:35:00 编辑

解决方案 »

  1.   

    using System;//F:\>Test
    //      *
    //     ***
    //    *****
    //   *******
    //  *********
    // ***********
    //*************
    // ***********
    //  *********
    //   *******
    //    *****
    //     ***
    //      *
    public class MainClass

        static void Main(string[] args)
        {
            int i, j;
            bool d ;
            i = 0;
            j = 0;
            d = true;
            while(i<=13 && i >= 0)
            {
                j = 0;
                while(j<=13 && j >=0 )
                {
                    if( (j >=(13-i)/2) && (j<=(13+i)/2))
                        Console.Write("*");    
                    else
                        Console.Write(" ");
                    j++;
                }
                Console.WriteLine();            if (i >=12)
                {
                    d = false;
                }
                
                if(d)
                {
                    i++; i++;
                }
                else
                {
                    i--; i--;
                }        }
            Console.ReadKey();
        }}
      

  2.   

    以前学习C语言的时候写过这个程序 当初也是用了好几层for循环 呵呵