-4

Please help! I ran this program and entered all 3 inputs but the last writeline code wouldn't run and the program just exits itself! I have no idea because I follow the book exactly!

        string userName = "";
        int userAge = 0;
        int currentYear = 0;

        Console.Write("Please enter your name: ");
        userName = Console.ReadLine();
        Console.Write("Please enter your age: ");
        userAge = Convert.ToInt32(Console.ReadLine());
        Console.Write("Please enter the current year: ");
        currentYear = Convert.ToInt32(Console.ReadLine());

        Console.WriteLine("Hello World! My name is {0} and I am {1} years old. I was born in {2}.", userName, userAge, currentYear - userAge);
crashmstr
  • 28,043
  • 9
  • 61
  • 79
Yan Tsui
  • 1
  • 1

1 Answers1

-3

at the end of the code add:

Console.ReadLine();
nazim hatipoglu
  • 634
  • 10
  • 24