Write an application that stores 12 integers in an array. Display the ingeter from first to last, and then display the integers from last to first.
#include <iostream>
using namespace std;
int main()
{
int A[12] = { 1, 2, 3, 5, 6, 9, 5, 10, 5, 8, 12, 11 };
cout << "Array in right order: ";
for (int i = 0; i < 12; i++)
{
cout << A[i] << " ";
}
cout << endl;
cout << "Array in reverse order: ";
for (int i = 11; i >= 0; i--)
{
cout << A[i] << " ";
}
cout << endl;
return 0;
}
Comments
Leave a comment