title: How to store the result of each iteration of a for loop into an array in java
body: <p>Score Finder (100 Marks)</p>
  
  <p>Praveen is finding a job as a Computer Science teacher in school. 
  He has been rejected many times by different schools but this time he is determined to get the job. 
  He goes to the principal of the school St. Mary.</p>
  
  <p>The principal says that in his school there is Grading and Credit system.
  There are N subjects and each subject has a credit Ci attached to it (1 &lt;= i &lt;= N). 
  Each student gets a particular grade in each subject and each grade has a point value which are:</p>
  
  <pre><code>A = 10, 
  A(minus) = 9, 
  B = 8, 
  B(minus) = 7, 
  C = 6, 
  C(minus) = 5 
  </code></pre>
  
  <p>Now if there are 3 subjects of credits 4, 3 and 2 respectively and a particular student scores A(minus), 
  B and C in these 3 subjects respectively then his score would be calculated as follows:
  Total Score=Summation of product of Grade point and corresponding credit for each subject.</p>
  
  <pre><code>= ( (9*4) + (3*8) + (2*6) ) = 72.
  </code></pre>
  
  <p>He wants Praveen to tell total distinct Scores that are possible 
  to be given to a student given credits of N subjects by assigning different grades to each subject.</p>
  
  <p>Input Format
  Your function contains a single argument- a one-dimensional Integer Array A of N elements where each represents Credit of that subject.
  The first line of input contains an Integer N denoting the size of the array.
  Next N lines of input each containing an Integer denoting the credit Ci of ith subject</p>
  
  <pre><code>Constraints
  1 &lt;= N &lt;= 100
  1 &lt;= Ci &lt;= 5
  </code></pre>
  
  <p>Output Format
  You must return a single integer denoting the total number of scores that are possible to be given.</p>
  
  <pre><code>Sample TestCase 1
  Input
  
  2
  1
  2
  Output
  
  16
  </code></pre>
  
  <p>now I am writing code like this</p>
  
  <pre><code>package javaapplication1;
  
  import java.util.Scanner;
  
  public class CandidateCode {
      private static void possibleCombination(int input) {
          int i=0;
          int[] a=new int[Grades.length];
  
          a[i]=input;
          System.out.println("the a is "+a[i]);
      }
  
      private static final int[] Grades = new int[]{10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
  
      public static void main(String[] args) {
          int i=0,j,totalSummation=0;
          Scanner uInput = new Scanner(System.in);
          System.out.println("Enter length of Array:");
          int index = uInput.nextInt();
          int[] Credit = new int[index];
          for (i = 0; i &lt;= Credit.length-1; i++) {
              Credit[i] = uInput.nextInt();
              System.out.println("credit is" + Credit[i]);
              for ( j = 0; j &lt;= Grades.length - 1; j++) {
                  totalSummation = +(Grades[j] * Credit[i]);
                  possibleCombination(totalSummation);
                  // System.out.println("total sum is " + totalSummation);
              }
          } 
      }
  }
  </code></pre>
  
  <p>Now I want to store the values calculated in each iteration...
  Meaning for 
  iteration first the values are 10,9,8,7,6,5,4,3,2,1 
  itertion second the values are 20,18,16,14,10,8,6,4,2</p>
  
  <p>i want to sum each value of 1st iteration with all the values of 2nd iteration.
  i,e 10+20, 10+18, 10+16, 10+14, 10+10, 10+8, 10+6, 10+4, 10+2
  similarly for 9,8,7,6,5,4,3,2,1</p>
  
  <p>To achieve this I need to store the values per iteration but I am stuck here, please guys help me to get rid of this problem thank you in advance.</p>