title: How to fix 'Use of unassigned local variable' in C#
body: <p>I am new to C#, my last programming language was C</p>
  
  <p>I kept getting Use of unassigned local variable 'average'
  The <code>average</code> it is pertaining was the <code>average /= 10;</code></p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  
  namespace ConsoleApp1
  {
      class Program
      {
          static void Main(string[] args)
          {
              int i, average;
              int[] scores = new int[10];
  
              Console.WriteLine("Enter 10 scores");
              for (i = 0; i &lt; 10; i++)
              {
                  scores[i] = Convert.ToInt32(Console.ReadLine());
              }
  
              for (i = 0; i &lt; 10; i++)
              {
                  average = scores[i] + scores[i + 1];
                  i++;
              }
  
              average /= 10;
  
              Console.WriteLine("Average of All the Scores: {0}", average);
              Console.Read();
          }
      }
  }
  </code></pre>