C#: Concatenate three strings and display the result
Write a C# Sharp program to 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 :
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.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics