import java.io.*;
class simple_print_array_in_revrse_order
{
public static void main(String args[])
{
int a[]=new int[10];
int i,n;
try
{
DataInputStream cin=new DataInputStream(System.in);
System.out.println("Entre the array size");
n=Integer.parseInt(cin.readLine());
System.out.println("Entre elements in the array");
for(i=0;i<n;i++)
{
a[i]=Integer.parseInt(cin.readLine());
}
System.out.println("elements in the array");
for(i=0;i<n;i++)
{
System.out.println(a[i]);
}
System.out.println("elements in the array in reverse order");
for(i=n-1;i>=0;i--)
{
System.out.println(a[i]);
}
}
catch(Exception e)
{
System.out.println("wrong data");
}
}
}
class simple_print_array_in_revrse_order
{
public static void main(String args[])
{
int a[]=new int[10];
int i,n;
try
{
DataInputStream cin=new DataInputStream(System.in);
System.out.println("Entre the array size");
n=Integer.parseInt(cin.readLine());
System.out.println("Entre elements in the array");
for(i=0;i<n;i++)
{
a[i]=Integer.parseInt(cin.readLine());
}
System.out.println("elements in the array");
for(i=0;i<n;i++)
{
System.out.println(a[i]);
}
System.out.println("elements in the array in reverse order");
for(i=n-1;i>=0;i--)
{
System.out.println(a[i]);
}
}
catch(Exception e)
{
System.out.println("wrong data");
}
}
}
No comments:
Post a Comment