CSharp - Write program to Read Decimal Value Input

Requirements

You will read a decimal number from the user.

You will write program that accepts a decimal number from the user and repeats it immediately on the screen.

Hint

You convert text input into a corresponding number by calling the Convert.ToDouble method.

To store a converted number, you use a variable of type double.

Demo

using System;

class Program/*from  w  w w.  j  av  a  2  s . c  o  m*/
{
    static void Main(string[] args)
    {
        // Decimal input 
        Console.Write("Enter a decimal number: ");
        string input = Console.ReadLine();
        double decimalNumber = Convert.ToDouble(input);

        // Repeating entered number to the output 
        Console.WriteLine("You have entered number " + decimalNumber);
    }
}

Result