class Averager
{
static void Main()
{
var total = 0.0;
while(true)
{
Console.Write("Enter a number or type \"done\" to see the average: ");
var entry = Console.ReadLine();
var addition = double.Parse(entry);
double counter = 0;
counter += 1;
total += addition;
if(entry.ToLower() == "done")
{
Console.WriteLine("Average" + total / counter);
break;
}
}
}
}
When I prompt "done" I have a Unhandled Exception: System.FormatException: Input string was not in a correct format.
My target is after "done" print sum of all numbers divided by the total by the number of numbers entered. Please help.