- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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
- Related Articles
- How to read a line from the console in C#?
- How to print colored text in the console using JavaScript?
- How do I print a message to the error console using JavaScript?
- How do I print Unicode characters in the console using JavaScript?
- How to print a blank line in C#?
- How to print to console an object in a MongoDB script?
- How to print a BinaryTriangle using C#?
- How can I clear console using C++?
- Query MongoDB subdocument to print on one line?
- How to print a diamond using nested loop using C#?
- How to set the duration of animation on a Line using FabricJS?
- How to change the size of the Console using PowerShell?
- How to clear console in C?
- How do I print debug messages in the Google Chrome JavaScript Console?
- How to print a semicolon(;) without using semicolon in C/C++?

Advertisements