w3resource

C#: Concatenate three strings and display the result

C# Sharp String: Exercise-36 with Solution

Write a C# Sharp program to concatenate three strings and display the result.

C# Sharp Exercises: Concatenate three strings and display the result.

Sample Solution:-

C# Sharp Code:

using System;

public class Example36
{
   public static void Main()
   {
      // Define three strings to concatenate.
      String str1 = "Don't count your chickens, ";
      String str2 = "before the eggs, ";
      String str3 = "have hatched.";

      // Concatenate the strings together.
      var str = String.Concat(str1, str2, str3);

      // Display the concatenated string.
      Console.WriteLine(str);
   }
}

Sample Output:

Don't count your chickens, before the eggs, have hatched

Flowchart :

Flowchart: C# Sharp Exercises - concatenate three strings and display the result.

C# Sharp Code Editor:

Improve this sample solution and post your code through Disqus

Previous: Write a C# Sharp program to concatenate a list of variable parameters.
Next: Write a C# Sharp program to concatenate the array values of strings.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Follow us on Facebook and Twitter for latest update.