Richard is spot on with the problem you have noticed, but do yourself a favour and don't use Convert for user input. If the user mistypes - and everybody does - then Convert will fail and your app will crash. That's OKish with five values, but for a user it's very, very annoying if they type 19 of 20 and the app crashes and throws everything away! Instead, use the TryParse methods:
int\[\] nums = new int\[5\];
for (int i = 0; i < 5; i++)
{
do
{
Console.Write("Enter element value " + i + ": ");
string input = Console.ReadLine();
if (int.TryParse(input, out nums\[i\]))
{
break;
}
Console.WriteLine(input + " is not a number!");
} while (true);
}
Sent from my Amstrad PC 1640 Never throw anything away, Griff Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!