1
Good with a doubt in this code , he in line 14 of me an error as you can see in the photo ...
Solutions ??
using System;
public class Exercise052
{
public static void Main()
{
Console.Write("Cuantos datos reservo: ");
int repeticiones = Convert.ToInt32(Console.ReadLine());
float numero;
float[] listaNumeros = new float[repeticiones];
for (int i = 1; i <= repeticiones; i++)
{
Console.Write("Dime numero {0} para guardar en la lista: ", i);
listaNumeros[i] = Convert.ToSingle(Console.ReadLine());
}
Console.Write("Que numero comprueba en la lista? ");
numero = Convert.ToSingle(Console.ReadLine());
while (Console.ReadLine() != "end")
{
for (int i = 1; i <= repeticiones; i++)
{
if (listaNumeros[i] == numero)
Console.WriteLine("El número {0} existe en la lista", numero);
}
}
}
}
What is the error? Write the question. Do not use images.
– Renato C.Francisco
The error that appears is " System.Indexoutofrangeexception: 'Index was Outside the Bounds of the array.'"
– Ivo Faria