Answer:
The code to this question can be described as follows:
Code:
System.out.println("first we simply prints array value, then prints value in reverse order: "); //message
//loop to print array value
for(i=0; i<NUM_VALS; ++i) //using for loop
{
System.out.print(courseGrades[i]+" "); //print values
}
System.out.print("\n");
//loop to print array value in reverse order
for(i=NUM_VALS-1; i>=0; --i) //using for to print value in reverse order
{
System.out.print(courseGrades[i]+" "); //print value
}
Explanation:
In the above code two for loop is declared, in which first loop it prints array value normally, and in the second loop it prints array value in its reverse order, the working of both loops can be described as follows: