Code:-
#include<iostream>
using namespace std;
void main()
{
int arr[10];
cout<<"Enter 10 digits = ";
for(int i=0;i<10;i++)
{
cin>>arr[i];
}
//forward order
cout<<"forward order"<<endl;
for(int i=0;i<10;i++)
{
cout<<arr[i]<<endl;
}
//reverse order
cout<<"reverse order"<<endl;
for(int i=9;i>=0;i--)
{
cout<<arr[i]<<endl;
}
}
Output:
#include<iostream>
using namespace std;
void main()
{
int arr[10];
cout<<"Enter 10 digits = ";
for(int i=0;i<10;i++)
{
cin>>arr[i];
}
//forward order
cout<<"forward order"<<endl;
for(int i=0;i<10;i++)
{
cout<<arr[i]<<endl;
}
//reverse order
cout<<"reverse order"<<endl;
for(int i=9;i>=0;i--)
{
cout<<arr[i]<<endl;
}
}
Output:
0 Questions:
Post a Comment