import java.io.*;
class Sub
{
int a[],n,b[],j,i;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
public void getData()throws IOException
{
System.out.println("enter the limit and enter the nos:");
n=Integer.parseInt(br.readLine());
a=new int[n+1];
for( i=0;i<n;i++)
{
a[i]=Integer.parseInt(br.readLine());
}}
class Sub
{
int a[],n,b[],j,i;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
public void getData()throws IOException
{
System.out.println("enter the limit and enter the nos:");
n=Integer.parseInt(br.readLine());
a=new int[n+1];
for( i=0;i<n;i++)
{
a[i]=Integer.parseInt(br.readLine());
}}
public void display()
{
System.out.println("reverse is ");
b=new int[21];
for(i=0,j=n-1;i<n;i++,j--)
{
b[j]=a[i];
}
for(i=0,j=n;i<n;i++,j--)
{
a[i]=b[i];
System.out.println(a[i]);
}
}
}
class Array
{
public static void main(String arg[])throws IOException
{
Sub t=new Sub();
t.getData();
t.display();
}
}
0 comments:
Post a Comment