Saturday, 29 November 2014

Take input in an array of 5 elements. Copy each element of array into an another array of 5 elements in reverse order. Print the array.

Leave a Comment
Code:-

#include<iostream>
using namespace std;
void main()
{
int arr1[5],arr2[5];
//Input
cout<<"Enter 5 Elements = "<<endl;
for(int i=0;i<5;i++)
{
cin>>arr1[i];
}
//Output
cout<<"Output in Reverse Order also all array store in arr2 in reverse order = "<<endl;
for(int j=4, i=0;j>=0&&i<5;i++,j--)
{
arr2[i]=arr1[j];
cout<<arr2[i]<<endl;
}

}

Output


If You Enjoyed This, Take 5 Seconds To Share It