Hello World प्रोग्राम
Hello World वह पहला program है जो ज़्यादातर लोग लिखते हैं, एक छोटा सा जो बस एक greeting print करता है। यह computer को आपकी पहली wave hello जैसा है, और हर C# program की Main नाम की एक शुरुआती जगह होती है।
In this page:
Syntax
using System;
class Program
{
static void Main(string[] args)
{
Console.WriteLine("text");
}
}
Hello World
हर C# program एक class के अंदर Main method में execution शुरू करता है। Console.WriteLine text को standard output पर उसके बाद एक newline के साथ print करता है। यह आपके setup के काम करने की पुष्टि के लिए उपयोग होने वाला traditional पहला program है।
Note:
using System; line उस namespace को import करती है जिसमें Console होता है।उदाहरण: Hello World
using System;
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
}
}
Login to try C/C++/Java/PHP code in the editor
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the
view already swaps in the hi_ translation fields (or blanks these
out if untranslated), so this renders correctly for both languages
without a lang_code check here. #}
आम गलतियां
Console.WriteLine("Hello");के आखिर में semicolon भूल जाना, जो एक compile error देता है।- lowercase में
console.writelineलिखना, जबकि C# case-sensitive है और नामConsole.WriteLineहै। dotnet runसे project को build और run करने के बजाय.csfile को सीधे चलाना।
🔒
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: