Console.ReadLine not working it doesnt give the user an opportunity to type

this is a simple program that converts human years to dog years but the string Age = Console.ReadLine(); is not working the program doesnt give the user a chance to input instead the output is:

what is your age?
your age in dog years is:0

My code:

       using System;

        namespace Review
        {
          class Program
          {
            static void Main(string[] args)
            {
              Console.WriteLine("what is your age?");
              string Age = Console.ReadLine();  // this line is as if not read by the program
              int userAge = Convert.ToInt32(Age);
              Console.WriteLine("your age in dog years is:" + userAge/5);
            }
          }
        }


Read more here: https://stackoverflow.com/questions/64412551/console-readline-not-working-it-doesnt-give-the-user-an-opportunity-to-type

Content Attribution

This content was originally published by Xueircas at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: