0

Spacing the Input

Hi Guys How can I space the input? without changing - Console.WriteLine(fullName); Meaning if I enter: JohannesMokobi - it needs be Johannes Mokobi? using System; class Program { static void Main(string[] args) { Console.Write("input first name"); string firstName; firstName = Console.ReadLine(); Console.Write("input surname"); string surname; surname = Console.ReadLine(); string fullName; fullName = firstName + surname; Console.WriteLine(fullName); // input surname // results = name + surname // print results } }

14th Mar 2018, 8:09 AM
Johannes Mokobi
Johannes Mokobi - avatar
3 Respostas
+ 2
Change the following line: fullName = firstName + surname; Into following: fullName = firstName + " " + surname; Simply put a space in between firstName and surname. Hth, cmiiw
14th Mar 2018, 9:18 AM
Ipang
+ 2
Thanks a million
14th Mar 2018, 11:31 AM
Johannes Mokobi
Johannes Mokobi - avatar
+ 2
You're welcome mate, I'm glad if it helps : )
14th Mar 2018, 1:00 PM
Ipang