等腰三角形

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { try { Console.Write("请输入等腰三角形的行数:"); int number = Convert.ToInt32(Console.ReadLine()); for (int i = 1; i <= number; i++) { for (int j = 1; j <= number - i; j++) { Console.Write(" "); } for (int a = 1; a <= 2 * i - 1; a++) { Console.Write("*"); } Console.WriteLine(); } } catch { Console.WriteLine("您输入的程序错误"); } Console.ReadKey(); } } }

你可能感兴趣的:(等腰三角形)