Concatenation of Two strings in C#

C# program to concatenate two strings.

Source code :

using System;
class Example
{
    static void Main()
    {
        string str1 = "Code";
        string str2 ="Cry";
        string str3=string.Concat(str1, str2);
        Console.WriteLine(str3);
    }
}

Output :

CodeCry

Notes :

The functionConcat()concatenates the second string to the first string defined inside the paranthesis.

Algorithm :

  1. Get the strings from the user.
  2. Concatenate the strings using Concat() function.
  3. Print the concatenated string.

Output :


                

Comments :