Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> C#

วิธีพิมพ์บรรทัดว่างหลายบรรทัดใน C#

ใช้ลูป while พิมพ์บรรทัดว่าง 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!\n");
            Console.ReadLine();
        }
    }
}