Multiple User Inputs | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Multiple User Inputs

If I am making a Program in C# like a question game, and I am trying to get my program to run a question after the user has answered, how would I put this into code? P.S I'm still learning C# but I am curious as to user inputs the code I am writing is below. namespace Hacker_Experiance1 { class Game { static void Main(string[]args) { string yourName; Console.WriteLine("Wh47 i2 y0ur h4ck3r n4m3?"); yourName = Console.ReadLine(); Console.WriteLine("W3lc0m3 {0}", yourName); int age = Convert.Toint34(Console.ReadLine()); Console.WriteLine("Agent", yourName, "You are {0} years old", age); } } }

4th Oct 2017, 8:26 PM
C0D3X
C0D3X - avatar
2 Answers
+ 7
you made few mistakes here... 1. Convert.Toint34(); should be //Convert.ToInt32(); 2. concatenation of string to integer is better done with ( + ) other than ( , ) 3. When you want to get multiple inputs on the sololearn code playground, you must use the 'ENTER' key to denote next input. Eg: Joseph 'ENTER' 55. will work for your code here's a reference https://code.sololearn.com/c4Ok0Ey4JPsR/?ref=app
4th Oct 2017, 9:01 PM
Nomeh Uchenna Gabriel
Nomeh Uchenna Gabriel - avatar
+ 1
Nomeh you are a legend thank you so muh
5th Oct 2017, 7:02 PM
C0D3X
C0D3X - avatar