+ 1
What am i doing wrong?
static void Main(string[] args) { string myName; int myAge = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("what is your name and age ?"); myName = Console.ReadLine(); Console.WriteLine("Hello ! {0}", myName); Console.WriteLine("and {0}", myAge); }
3 Respostas
+ 8
The code is not consistent as the variables are declare and initialize in 2 different ways.
Besides, I guess the age input should be followed after the question prompt, not before.
P/S: If possible please try to embed the code in Code Playground so others can read and understand your code better. 😉
+ 4
I tried The code, it could be improved but it works. What problem did you have?
+ 2
when trying to take an integer from input, you should use int.Parse() not Convert.ToInt32(), just some advice.