It is a number counter, if one enters OK
should exit and show the sum of the numbers entered.
The counter works fine but when I enter OK
instead of leaving the while the application crashea.
static void Main(string[] args)
{
var contador = 0;
Console.WriteLine("Ingrese un numero... Para salir presione OK");
var numero = Console.ReadLine();
contador = Convert.ToInt32(numero);
while (numero.ToLower() != "ok")
{
Console.WriteLine("Ingrese un numero... Para salir presione OK");
numero = Console.ReadLine();
contador += Convert.ToInt32(numero);
}
Console.WriteLine("La suma de sus numeros es= "+contador);
}