#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int ar[100];
int r,t=0,i,j;
for(i=0;i<100;i++)
{
ar[i]=0;
}
cout<<"Enter the range:(less than 100) "<<endl;
cin>>r;
cout<<" Enter the elements of the array:"<<endl;
for(i=0;i<r;i++)
{
cout<<"Enter element number: "<<(i+1)<<endl;
cin>>ar[i];
}
r=r-1;
for(i=0;i<(r/2);i++)
{
t=ar[i];
ar[i]=ar[r-i];
ar[r-i]=t;
}
cout<<"The reversed elements of the array:"<<endl;
for(i=0;i<r+1;i++)
{
cout<<ar[i];
}
getch();
}
No comments:
Post a Comment