w3resource
C# Sharp Programming Exercises

C# Sharp Exercises: Print hello and your name in a separate line


C# Sharp Basic: Exercise-1 with Solution

Write a C# Sharp program to print Hello and your name in a separate line.

C# Sharp Exercises: Print hello and your name in a separate line

Sample Solution:

C# Sharp Code:

public class Exercise1
{
    public static void Main( )
    {
         System.Console.WriteLine("Hello");
         System.Console.WriteLine("Alexandra Abramov!");
    }
}

Sample Output:

Hello
Alexandra Abramov!

System.Console.WriteLine method writes the specified data, followed by the current line terminator, to the standard output stream.

Details of WriteLine() Method:

Methods Description
WriteLine() This method writes the current line terminator to the standard output stream.
WriteLine(Boolean) This method writes the text representation of the specified Boolean value, followed by the current line terminator, to the standard output stream.
WriteLine(Char) This method writes the specified Unicode character, followed by the current line terminator, value to the standard output stream.
WriteLine(Char[]) This method writes the specified array of Unicode characters, followed by the current line terminator, to the standard output stream.
WriteLine(Char[], Int32, Int32) This method writes the specified subarray of Unicode characters, followed by the current line terminator, to the standard output stream.
WriteLine(Decimal) This method writes the text representation of the specified Decimal value, followed by the current line terminator, to the standard output stream.
WriteLine(Double) This method writes the text representation of the specified double-precision floating-point value, followed by the current line terminator, to the standard output stream.
WriteLine(Int32) This method writes the text representation of the specified 32-bit signed integer value, followed by the current line terminator, to the standard output stream.
WriteLine(Int64) This method writes the text representation of the specified 64-bit signed integer value, followed by the current line terminator, to the standard output stream.
WriteLine(Object) This method writes the text representation of the specified object, followed by the current line terminator, to the standard output stream.
WriteLine(Single) This method writes the text representation of the specified single-precision floating-point value, followed by the current line terminator, to the standard output stream.
WriteLine(String) This method writes the specified string value, followed by the current line terminator, to the standard output stream.
WriteLine(String,Object) This method writes the text representation of the specified object, followed by the current line terminator, to the standard output stream using the specified format information.
WriteLine(String,Object,Object) This method writes the text representation of the specified objects, followed by the current line terminator, to the standard output stream using the specified format information.
WriteLine(String,Object,Object,Object) This method writes the text representation of the specified objects, followed by the current line terminator, to the standard output stream using the specified format information.
WriteLine(String,Object,Object,Object,Object) This method writes the text representation of the specified objects and variable-length parameter list, followed by the current line terminator, to the standard output stream using the specified format information.
WriteLine(String,Object[]) This method writes the text representation of the specified array of objects, followed by the current line terminator, to the standard output stream using the specified format information.
WriteLine(UInt32) This method writes the text representation of the specified 32-bit unsigned integer value, followed by the current line terminator, to the standard output stream.
WriteLine(UInt64) This method writes the text representation of the specified 64-bit unsigned integer value, followed by the current line terminator, to the standard output stream.

Flowchart:

Flowchart: C# Sharp Exercises - Print hello and your name in a separate line

C# Sharp Code Editor:

Improve this sample solution and post your code through Disqus

Previous: C# Sharp Basic Exercises.
Next: Write a C# Sharp program to print the sum of two numbers.

What is the difficulty level of this exercise?



New Content: Composer: Dependency manager for PHP, R Programming