Tuesday 21 August 2012


import java.io.*;
class Subp
{
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.print("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.print(a[i]);
}
}
}
class Array
{
public static void main(String arg[])throws IOException

{
Subp t=new Subp();
t.getData();
t.display();
}
}

0 comments:

Post a Comment

Blogroll

Blogger templates

About