title: Printing array elements with a for loop
body: <p>This is a challenge question from my online textbook I can only get the numbers to prin forward... :(</p>
  
  <p>Write a for loop to print all elements in courseGrades, following each element with a space (including the last). Print forwards, then backwards. End each loop with a newline. 
  Ex: If courseGrades = {7, 9, 11, 10}, print:
  7 9 11 10 
  10 11 9 7 </p>
  
  <p>Hint: Use two for loops. Second loop starts with i = NUM_VALS - 1. </p>
  
  <p>Note: These activities may test code with different test values. This activity will perform two tests, the first with a 4-element array (int courseGrades[4]), the second with a 2-element array (int courseGrades[2]). </p>
  
  <pre><code>import java.util.Scanner;
  
   public class CourseGradePrinter {
   public static void main (String [] args) {
    final int NUM_VALS = 4;
    int[] courseGrades = new int[NUM_VALS];
    int i = 0;
  
    courseGrades[0] = 7;
    courseGrades[1] = 9;
    courseGrades[2] = 11;
    courseGrades[3] = 10;
  
    /* Your solution goes here  */
  
    for(i=0; i&lt;NUM_VALS; i++){
       System.out.print(courseGrades[i] + " ");
    }
  
    for(i=NUM_VALS -1; i&gt;3; i++){
       System.out.print(courseGrades[i]+ " ");
       }
  
    return;
  }
  }
  </code></pre>