如何在 C# 中打印多个空行?
csharpprogrammingserver side programming更新于 2025/7/12 9:07:17
要显示多个空行,我们需要一个 while 循环。
这里,我们使用 Console.WriteLine() 打印 10 个空行;
while (a < 10) {
Console.WriteLine(" ");
a++;
}
以下是显示多个空行的完整代码 −
示例
using System;
namespace Program {
public class Demo {
public static void Main(String[] args) {
int a = 0;
while (a < 10) {
Console.WriteLine(" ");
a++;
}
Console.WriteLine("Displayed 10 blank lines above!
");
Console.ReadLine();
}
}
}

