Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
How to print a line on the console using C#?
To display a line, Console.Write() is used in C#.
Console displays the result on the console. I have first set a string.
string str = "Tom Hanks is an actor";
Now displaying the above line.
Console.WriteLine(str);
The following is the complete code −
Example
using System;
namespace Program {
public class Demo {
public static void Main(String[] args) {
string str = "Tom Hanks is an actor";
Console.WriteLine("Displaying a line below");
Console.WriteLine(str);
Console.ReadLine();
}
}
}
Output
Displaying a line below Tom Hanks is an actor
Advertisements
