title: C# How to correct wrong input within an array
body: <p>So I need to do a array loop with students for class. The input has to be between 0-100 otherwise it doesn't accept the input from the user.</p>
  
  <pre><code>  Console.WriteLine("How many students?");
    int num1 = Keyboard.ReadInt();
    int[] array = new int[num1];
    Console.WriteLine("Give the student grades: ");
    for (int i = 0; i &lt; array.Length; i++)
    {
        int wrong;
        wrong = Keyboard.ReadInt();
        if (wrong &gt; 0 &amp;&amp; wrong &lt;= 100)
        {
            array[i] = wrong;
        }
        else
        {
            while (wrong &lt; 0 &amp;&amp; wrong &gt;= 100)
            {
                Console.WriteLine("Wrong input:");
                wrong = Keyboard.ReadInt();
            }
        }
  </code></pre>