วันพฤหัสบดีที่ 17 กันยายน พ.ศ. 2552

easySwap

import java.util.Scanner;
public class Swapeasy {
public static void main(String args[])
{
Scanner scan=new Scanner(System.in);
int amount=scan.nextInt();

int number[]=new int[amount];
int numberreverse[]=new int [amount];

/////////////get number from user //and Swap
int j=amount-1;
for (int i=0; i < amount;i++)
{
number[i]=scan.nextInt();
numberreverse[j]=number[i];
j--;
}
for(int i=0;i < amount;i++)
{
System.out.printf("%d\n",numberreverse[i]);
}
}
}

ไม่มีความคิดเห็น:

แสดงความคิดเห็น