Users Online

· Guests Online: 156

· Members Online: 0

· Total Members: 188
· Newest Member: meenachowdary055

Forum Threads

Newest Threads
No Threads created
Hottest Threads
No Threads created

Latest Articles

C# Program to Concatenate Two Strings

C# Program to Concatenate Two Strings

 

This is a C# Program to concatenate two strings.

Problem Description

This C# Program Concatenates Two Strings.

Problem Solution

Here the two strings are joined together to form a single string with a build in string function.

Program/Source Code

Here is source code of the C# Program to Concatenate Two Strings. The C# program is successfully compiled and executed with Microsoft Visual Studio. The program output is also shown below.

/*
 * C# Program to Concatenate Two Strings
 */
using System;
class Program
{
    static void Main()
    {
        string s1 = "Good";
        string s2 ="Morning";
        string s3=string.Concat(s1, s2);
        Console.WriteLine(s3);
        Console.ReadLine();
    }
}
Program Explanation

This C# program is used to concatenate two strings. We have already defined two strings using ‘s1’ and ‘s2’ variables. Using ‘s3’ variable concatenate the two strings using Concat() function.

 
Runtime Test Cases
 
GoodMorning

 

Comments

No Comments have been Posted.

Post Comment

Please Login to Post a Comment.

Ratings

Rating is available to Members only.

Please login or register to vote.

No Ratings have been Posted.
Render time: 0.72 seconds
10,814,872 unique visits