#include<iostream>
using namespace std;
int main()
{
int arr[35];
int n;
cout<<"Enter the size:";
cin>>n;
cout<<"Enter array elements:";
for(int i=0;i<n;++i)
cin>>arr[i];
int temp,i,j;
for(i=0,j=n-1;i<n/2;++i,--j)
{
temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
}
cout<<"the reversed array is"<<arr<<" ";
return 0;
}
using namespace std;
int main()
{
int arr[35];
int n;
cout<<"Enter the size:";
cin>>n;
cout<<"Enter array elements:";
for(int i=0;i<n;++i)
cin>>arr[i];
int temp,i,j;
for(i=0,j=n-1;i<n/2;++i,--j)
{
temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
}
cout<<"the reversed array is"<<arr<<" ";
return 0;
}
0 comments:
Post a Comment