+ 1

Why isn't this code working??

I am confused and annoyed 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 yourName; Console.WriteLine("What is your name?"); yourName = Console.ReadLine(); Console.WriteLine("Hello {0}", yourName); string yourAge; Console.WriteLine("how old are you?"); yourAge = Console.ReadLine(); Console.WriteLine("Oh you are {1}", yourAge); } } }

25th Sep 2022, 7:13 PM
YaMaMo
YaMaMo - avatar
1 Answer
+ 4
It should be Console.WriteLine("Oh you are {0}", yourAge); Pay attention to the index 0. PLEASE LINK YOUR CODE INSTEAD OF PASTING IT IN THE DESCRIPTION. This way, it will be mire readable and people can actually test it
25th Sep 2022, 7:25 PM
Lisa
Lisa - avatar