कंसोल के माध्यम से बीप ध्वनि चलाने के लिए, कोड इस प्रकार है -
उदाहरण
using System; public class Demo { public static void Main(String[] args){ Console.WriteLine("Displaying standard output stream..."); Console.WriteLine("Standard Output Stream = "+Console.Out); Console.WriteLine("Beep sound through Console"); Console.Beep(); } }
आउटपुट
यह निम्नलिखित आउटपुट देगा -
Displaying standard output stream... Standard Output Stream = System.IO.TextWriter+SyncTextWriter Beep sound through Console
उदाहरण
आइए अब एक और उदाहरण देखें -
using System; public class Demo { public static void Main(String[] args){ Console.WriteLine("Displaying standard output stream..."); Console.WriteLine("Standard Output Stream = "+Console.Out); Console.WriteLine("Beep sound through Console"); Console.Beep(); Console.WriteLine("Beep sound through Console with frequence 1000 hertz and duration 500 milliseconds"); Console.Beep(1000, 500); } }
आउटपुट
यह निम्नलिखित आउटपुट देगा -
Displaying standard output stream... Standard Output Stream = System.IO.TextWriter+SyncTextWriter Beep sound through Console Beep sound through Console with frequence 1000 hertz and duration 500 milliseconds