try { Console.Write("请输入直角三角形的行数:"); int nums = Convert.ToInt32(Console.ReadLine()); for (int i = 1; i <= nums; i++) { for (int s = 0; s < nums - i; s++) { Console.Write(" "); } for (int j = 0; j < 2 * i - 1; j++) { Console.Write("*"); } Console.WriteLine(); } } catch { Console.WriteLine("输入有误"); } Console.ReadKey();
,....
网友评论