try { Console.WriteLine("请输入直角三角形高度"); int i = Convert.ToInt32(Console.ReadLine()); int a, b; for (a = 1; a <= i; a++)//行数 { for (b = 0; b < i - a; b++) {Console .Write(" "); } for (b =0; b<2*a-1; b++) { Console.Write("*"); } Console.WriteLine (); } } catch { } Console.ReadKey(); } } }
网友评论