How to make so that did not give an error
The index was outside the bounds of the array.
in the absence of zero. That is, what 2 condition is needed?
using System; namespace whileHomeWork { class Program { static void Main() { int[] intArray = {2, 3, 5, 9, 4, 7, 2}; int index = 0; while (intArray[index] != 0) { Console.WriteLine(intArray[index]); index++; } } } }
while (index < intArray.Length && intArray[index] != 0)- Dmitry D.