美文网首页
2018-12-20

2018-12-20

作者: 柏建春 | 来源:发表于2018-12-20 09:29 被阅读0次

#代码

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace ConsoleApplication4

{

    class Program

    {

        static void Main(string[] args)

        {

            Console.WriteLine("请输入三角形高度");

            int hang = Convert.ToInt32(Console.ReadLine());

            for (int i = 0; i < hang; i++)

            {

                for(int j=hang-i-1;j>0;j--)

                {

                        Console.Write("\0");

                }

                for (int x = 0; x < 2 * i +1; x++)

                {

                    Console.Write("*");

                }

                Console.WriteLine("");

            }

            Console.ReadKey();

        }

    }

}

#效果

相关文章

网友评论

      本文标题:2018-12-20

      本文链接:https://www.haomeiwen.com/subject/zwmekqtx.html