CSharp - Write program to Read Numeric Input from console window

Requirements

You will read some numbers from user via the console window.

You will write a program that takes a number from the user, stores it in a numeric variable, and finally repeats it to the user.

Hint

Console.ReadLine always reads text even if what you need is a number.

To convert text to a number, use the Convert.ToInt32 method.

Demo

using System;
using System.Globalization;

class Program//w ww. j av a 2 s  .c om
{
    static void Main(string[] args)
    {
        // Prompting the user 
        Console.Write("How old are you? ");

        // Reading line of text 
        string input = Console.ReadLine();

        // CONVERTING TO NUMBER (of entered text) 
        int enteredNumber = Convert.ToInt32(input);

        // Output of entered number 
        Console.WriteLine("Your age: " + enteredNumber);

    }
}

Result