What if you ask for to different inputs? One as string and one as int. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What if you ask for to different inputs? One as string and one as int.

Like string yourName = Console.ReadLine(); Console.WriteLine("Your name is {0}",yourName ); int yourAge = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Your age is {0}",yourAge ); I can only input the fhirst one but its not asking for the other. And is it possible to make a question for what your asking? Like: please fill in your name.

30th Jul 2016, 3:42 PM
Lars Erkeland
Lars Erkeland - avatar
1 Answer
+ 2
Try this: Console.Write("Enter your name please: "); string yourName = Console.ReadLine(); Console.WriteLine("Your name is {0}",yourName ); Console.Write("Now enter your age, {0}: ", yourName ); int yourAge = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Your age is {0}",yourAge );
1st Aug 2016, 5:07 PM
Alireza M
Alireza M - avatar