Console.WriteLine("Enter your name:");//Type your name and press enterstring nameInput = Console.ReadLine();Console.WriteLine("Hello, " + nameInput + "!"); // Prints the user's name
Console.WriteLine("Enter your age:");//Type your age and press enterstring ageInput = Console.ReadLine();int age = Convert.ToInt32(ageInput); // Convert the string to an integerConsole.WriteLine("Your age is: " + age);
Console.WriteLine("Hello World!");
Hello World!
Console.Write("Hello Estudy247! ");Console.Write("I would like to print the text on the same line.");
Hello Estudy247! I would like to print the text on the same line.
You may download the source code from the course repository on GitHub – https://github.com/estudy-247/input-output
You must be logged in to post a comment.
Username or Email Address
Password
Remember Me