+ 1

C# 5.2 Practice "Welcome Message"

Hi! I have a problem with the 5.2 exercise/practice in the C# course, it is called "Welcome Message". The problem is as follows: "You are organizing an important event and you should greet each participant with a welcome message. The given code outputs the message.". Task: Complete the program to take the participant's name as input and assign it to the "name" variable. Sample Input: Tom Sample Output: Hello Tom. Welcome to our event." I just have no idea how to solve this problem, it feels like I have tried everything so if you have solved it, I would really appreciate it if you could share and what I might be missing. I don't know how to complete the program.

25th Oct 2022, 8:49 AM
Emma Lindvall
Emma Lindvall - avatar
4 Respostas
+ 4
using System; namespace SoloLearn { class Program { static void Main(string[] args) { // string name; // declare only once string name = Console.ReadLine(); // use capital L in ReadLine() //take the name as input Console.WriteLine("Hello {0}. Welcome to our event.",name); // may asked to put dot. at end from output sample? recheck once... } } }
25th Oct 2022, 9:35 AM
Jayakrishna 🇮🇳
+ 3
It is Console.ReadLine()
25th Oct 2022, 9:33 AM
Lisa
Lisa - avatar
+ 1
Can you share your try here?
25th Oct 2022, 9:00 AM
Jayakrishna 🇮🇳
+ 1
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { string name; string name = Console.Readline(); //take the name as input Console.WriteLine("Hello {0}. Welcome to our event",name); } } }
25th Oct 2022, 9:01 AM
Emma Lindvall
Emma Lindvall - avatar