Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

C# Sharp Exercises: Concatenate the array values of strings

C# Sharp String: Exercise-37 with Solution

Write a C# Sharp program to concatenate the array values of strings.

Sample Solution:-

C# Sharp Code:

using System;
public class Example37
{
    public static void Main()
    {
        // Make an array of strings. Note that we have included spaces.
        string [] str = { "hello ", "welcome ", "to ", "C# Sharp ",
                        "create ", "Windows ", "client ", "applications "};

        // Put all the strings together.
        Console.WriteLine(string.Concat(str));

        // Sort the strings, and put them together.
        Array.Sort(str);
        Console.WriteLine(string.Concat(str));
    }
}

Sample Output:

hello welcome to C# Sharp create Windows client applications                                                  
                                                                                                              
hello applicationsC# Sharp client create to welcome Windows 

Flowchart :

Flowchart: C# Sharp Exercises - Concatenate the array values of strings.

C# Sharp Code Editor:

Improve this sample solution and post your code through Disqus

Previous: Write a C# Sharp program to concatenate three strings and display the result.
Next: Write a C# Sharp program to determine whether the string "birds" is a substring of a familiar.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.