0
The user pastes the values that will be saved within the array and then displays these values. However, the following error is occurring:
An unhandled Exception of type 'System.Indexoutofrangeexception' occurred in vetoor.exe ".
My code is as follows:
namespace vetoor
{
class Program
{
static void Main(string[] args)
{
int[] vet = new int[3];
int i,a;
for (i = 0; i < vet.Length; i++)
{
Console.WriteLine("Digite o numero");
vet[i] = int.Parse(Console.ReadLine());
}
for(a=0; a<4; a++)
{
Console.WriteLine("{0}", vet[i]);
}
Console.ReadKey();
}
}
}
Did any of the answers solve your question? Do you think you can accept one of them? Check out the [tour] how to do this, if you haven’t already. You would help the community by identifying what was the best solution for you. You can accept only one of them. But you can vote on any question or answer you find useful on the entire site (when you have enough score).
– Maniero