How to print values of multiple variables in one Console.WriteLine() statement?

Viewed 19241

I have three variables, firstName, middleName and lastName. I am reading the values of these three variables one by one as shown in the code below. I want to print the values of the three variables in one Console.WriteLine() statement. The output should be in the following way:

Let, firstName be: John; middleName be: Bradshaw; lastName be: Layfield

Output: John Bradshaw Layfield

Code:

Console.WriteLine("Enter First Name");
firstName = Console.ReadLine();
Console.WriteLine("\n");

Console.WriteLine("Enter Middle Name");
middleName = Console.ReadLine();
Console.WriteLine("\n");

enter code hereConsole.WriteLine("Enter Last Name");
lastName = Console.ReadLine();
Console.WriteLine("\n");
2 Answers
Related