In C#, to print the data on the console output screen the following method are used – Console.Write() and Console.WriteLine() method. Console is a predefined class of System namespace. While Write() and WriteLine() both are the Console Class methods.
The only difference between the Write() and WriteLine() is that Console.Write is used to print data without printing the new line, while Console.WriteLine is used to print data along with printing the new line.
Program 1: Example of Console.Write() in C#.
C#
// C# program to show the difference // between Console.Write and // Console.WriteLine using System; public class GFG{ static void Main(string[] args) { // use of Write() method Console.Write("Geeks"); Console.Write("For"); Console.Write("Geeks"); } } |
Output:
GeeksForGeeks
Program 2: Example of Console.WriteLine() in C#.
C#
// C# program to show the difference // between Console.Write and // Console.WriteLine using System; public class GFG{ static void Main(string[] args) { // use of WriteLine() method Console.WriteLine("Geeks"); Console.WriteLine("For"); Console.WriteLine("Geeks"); } } |
Output:
Geeks For Geeks
In the above code, program 1 shows the output without including the newline in the each console output and program 2 shows the output including the newline in the each console output.
Recommended Posts:
- Difference and Similarities between PHP and C
- Difference between Stop and Wait protocol and Sliding Window protocol
- Similarities and Difference between Java and C++
- Difference between Yaacomo and and XAP
- Difference between VoIP and and POTS
- Difference between ++*p, *p++ and *++p
- Difference Between DOS and Windows
- Difference between User Level thread and Kernel Level thread
- What’s difference between The Internet and The Web ?
- Difference between Priority Inversion and Priority Inheritance
- What’s difference between Linux and Android ?
- What’s difference between header files "stdio.h" and "stdlib.h" ?
- Difference between HTML and HTTP
- Difference between http:// and https://
- What's difference between MMU and MPU?
- What's difference between Microcontroller (µC) and Microprocessor (µP)?
- What's the difference between Scripting and Programming Languages?
- What’s difference between “array” and “&array” for “int array[5]” ?
- What's difference between char s[] and char *s in C?
- Difference between Ping and Traceroute
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

