program to reverse the elements in the array