Answer:
#include <iostream>
using namespace std;
int main()
{
int arr[] = {1, 2, 3, 4, 5, 6,7,8,9,10};
cout <<"Printing from first to last element\\"<<endl;
for (int i= 0; i < 10; i++)
{
cout <<arr[i]<<endl;
}
cout <<"Printing from last to first element\\"<<endl;
for (int i= 9; i >=0; i--)
{
cout <<arr[i]<<endl;;
}
return 0;
}
Step-by-step explanation:
We start off by creating an array of 10 integers as stated in the question. Then we use a for loop to print the values from the first element (index 0) to the last.... The logic for printing in reverse order is simple, we start from the last element (index 9 since there are ten elements) then keep subtracting one until i is equal to 0 (that is the last element)