title: Array method button calculation
body: <p>I wrote a code that does a 100 random numbers between -100,100 1st button calculates average of negative numbers 2nd button calculates average of odd positive.
  And here is where I am stuck how can I write a code that when I click on the 3rd button and it -5 from the 1st button value. Same problem for 4th button but if you could help me with this problem I can solve the last problem by myself.</p>
  
  <pre><code>    public Form1()
      {
          InitializeComponent();
      }
      private void button1_Click(object sender, EventArgs e)
      {
          int[] P1 = new int[100];
          Random rand = new Random();
          float enAvg = AvgNeg(P1);
          textBox1.Text = (enAvg).ToString("");
      }
      private void button2_Click(object sender, EventArgs e)
      {
          int[] P2 = new int[100];
          Random rand = new Random();
          float enAvg = AvgOddPos(P2);
          textBox2.Text = (enAvg).ToString("");
      }
      private void button3_Click(object sender, EventArgs e)
      {
          textBox1.Text = (Convert.ToInt32(textBox1.Text) + (-5).ToString());
      }
      private void button4_Click(object sender, EventArgs e)
      {
          textBox2.Text = (Convert.ToInt32(textBox1.Text) + (+ 10).ToString());
      }
      static float AvgNeg(int[] array)
      {
          Random rand = new Random();
          float sum = 0;
          int counter = 0;
          for (int i = 0; i &lt; array.Length; i++)
          {
              array[i] = rand.Next(-100, 100); 
              if (array[i] &lt; 0)
              {
                  sum += array[i];
                  counter++;
              }
          }
          float avg = sum / counter;
          return avg;
      }
      static float AvgOddPos(int[] array)
      {
          Random rand = new Random();
          float sum = 0;
          int counter = 0;
          for (int i = 0; i &lt; array.Length; i++)
          {
              array[i] = rand.Next(-100, 100);
              if (array[i] &gt; 0 % 1)
              {
                  sum += array[i];
                  counter++;
              }
          }
          float avg = sum / counter;
          return avg;
      }
  </code></pre>