Saturday, 29 November 2014

create array of integer type with 10 indexes and then print that array in forward and reverse order

Leave a Comment
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:


If You Enjoyed This, Take 5 Seconds To Share It