Q:

C# | Print messages/text (program to print Hello world)

1

C# | Print messages/text (program to print Hello world)

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Program:

/*c# basic program to print messages*/
using System;

class HelloWorld {
	static void Main() {
		//print text without inserting new line after the message
		Console.Write("Hello World,");
		Console.Write("How are you?");
		//print new line
		Console.WriteLine();
		//print text with new line after the message
		Console.WriteLine("Hello World");
		Console.WriteLine("How are you?");
		//print new line using escape sequence just like C language
		Console.WriteLine("Hello World\nHow are you?");
	}
}

Output

Hello World,How are you?
Hello World
How are you?
Hello World
How are you?

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now