170k views
1 vote
To store three different strings using three variables and print the string aftet concatenation​

1 Answer

4 votes

Answer:

Step-by-step explanation:

Certainly! Here's an example of how you can store three different strings using three variables and then concatenate them to print the resulting string:

```csharp

using System;

class Program

{

static void Main(string[] args)

{

string string1 = "Hello";

string string2 = "there";

string string3 = "world";

string result = string1 + " " + string2 + " " + string3;

Console.WriteLine(result);

}

}

```

In this example, we declare three string variables `string1`, `string2`, and `string3` to store the three different strings. Then, we use the concatenation operator `+` to combine the strings together with spaces in between. The resulting string is stored in the `result` variable. Finally, we use `Console.WriteLine()` to print the concatenated string to the console, which would display "Hello there world".

User Mr Speaker
by
8.0k points