I used double.Parse
and Convert.ToDouble
and got the same error
System.FormatException: Input string was not in a correct format
The problem might be your culutral setting.
Some countries uses a .
others uses a ,
try:
double num2 = double.Parse(Console.ReadLine(), NumberStyles.Any, CultureInfo.InvariantCulture);
or set the separator like:
var culture = (CultureInfo)CultureInfo.CurrentCulture.Clone();
culture.NumberFormat.NumberDecimalSeparator = ".";
double num2 = DateTime.Parse(Console.ReadLine(), culture);