作者xcycl (XOO)
看板C_Sharp
标题Re: [C#] 请问此题解法
时间Sun Sep 9 21:00:48 2007
※ 引述《[email protected] (ξ落入凡间的精灵ξ)》之铭言:
: 用双回圈输出以下的执行结果
: 1 2 3 4 5
: 2 3 4 5
: 3 4 5
: 4 5
: 5
: namespace C5d432
: {
: class Program
: {
: static void Main(string[] args)
: {
: for (int i = 5; i >=1; i--)
: {
: for (int j = 1; j <= 5 - i; j++)
: Console.Write(" ");
: for (int k = 1; k <= i; k++)
^^^^^ 这里要改
: Console.Write(k);
用 formatted string: "{0} ", k
或是接下去再 write 一个空白。
: Console.WriteLine();
: }
: Console.ReadLine();
: }
: }
: }
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 220.134.69.245