title: C# How would I convert grade percentages to letter grades?
body: <p>Noob here. I have written a program that allows a user to enter how many grades they would like to input into an array, and then lets them enter the grades for the number of indexes they chose. I am trying to output the total percentage grade based on the inputted grades, and also output the actual letter grade, but I am having trouble figuring out what I would code to convert to letter grades. Any help is appreciated.</p>
  
  <p>Code:</p>
  
  <pre><code>public static void Main(string[] args)
      {
          int ARRAYLENGTH = 0;
          int i = 0;
          double sum = 0;
  
          Console.WriteLine("How many scores would you like to enter? ");
          ARRAYLENGTH = Convert.ToInt32(Console.ReadLine());
  
          string[] test = new string[ARRAYLENGTH];
  
          for (i = 0; i &lt; test.Length; i++)
  
          {
              Console.Write("Enter your test score " + (i + 1) + ": ");
              test[i] =
              Console.ReadLine();
          }
          for (i = 0; i &lt; test.Length; i++)
          {
              sum = sum +
              Convert.ToDouble(test[i].Trim());
          }
          Console.WriteLine("\nThis is your average = " + (sum / test.Length));
          Console.WriteLine("\nYour grade is: ");//Not sure how this would work
          Console.Write("\nPress the [Enter] key to exit.");
          Console.ReadLine();
      }
  </code></pre>