
要显示多个空行,我们将使用 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();
}
}
}以上就是如何在C#中打印多个空行?的详细内容,更多请关注php中文网其它相关文章!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号