title: How to make a Partially Filled Array in C#
body: <p>I am trying to make a Partial array with this code in the Console Application. What I am trying to do is enter multiple values (Example test scores) on one Console.ReadLine, take the sums of the numbers entered, but if user inputs less than the LIMIT, for example inputs 5 values, but there is space for a total of 10, that it will just add up those 5 values. </p>
  
  <p>I want to be able to enter multiple values using an Array on a single line, but if I dont enter values for each parameter in <code>int [] scores = {0, 1, 2, ...];</code> it should be able to add up the numbers entered by the user, and forget the rest. For example if I enter 56 76 86 on one line, then enter 0 terminating the array, it will add up 56 76 86, and not require other numbers to fill the array.</p>
  
  <pre><code>    class Program
      {
          const int LIMIT = 10;
  
          static void Main(string[] args)
          {
              //Declarations:
              //Array Size
              //Array Scope
  
  
  
  
              int[] examScores = new int[LIMIT];
  
              //Define an Array of integers:
              int testNum = 1;
              int [] scores = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
  
              //1. Ask User Method:
                  //a.)Ask user to input numbers.
                  //b.)Save user numbers in an array
  
              Console.WriteLine("Input all of your test scores as the program prompts of");
              Console.WriteLine("each score on the lines below. (i.e. 89 25 87 98...)");
  
  
             //Purpose of this for method is to get user input and save to
             //an array.
  
              for (int i = 0; i &lt; scores.Length; i++)
              {
                  Console.WriteLine("\nEnter test score #{0}", testNum);
                  scores[i] = int.Parse(Console.ReadLine());
              }
              PrintScores(scores);
  
  
  
  
              Console.Read();
          }//End Main.
  
          //2. AddSum Method. 
          //Purpose: Take users input and add all numbers together.
          //Paramiters: Array numbers from Main saved as PrintScores
          //Returns: None
          //Prints: Sum of Scores.
          static void PrintScores(int[] scr)
          {
              int result = 0;
  
              for (int i = 0; i &lt; scr.Length; i++)
              {
                  result += scr[i];
              }
  
              Console.WriteLine("\n--------------------------------------");
              Console.WriteLine("Sum of your test scores equal: {0}", result);
  
  
          }
      }
  }
  </code></pre>