0
int [] x = {1,2,3,4,5,6,7,8,9,10};
for (int a : x){
System.out.print(a+" ");
}
int [] y = new int[10];
// reversing this array using loops
我被困在此代碼如何反轉這個整數數組?
int [] x = {1,2,3,4,5,6,7,8,9,10};
for (int a : x){
System.out.print(a+" ");
}
int [] y = new int[10];
// reversing this array using loops
我被困在此代碼如何反轉這個整數數組?
int [] x = {1,2,3,4,5,6,7,8,9,10};
for (int i = 0; i < x.length/2; i++)
{
int temp = x[i];
input[i] = x[x.length - 1 - i];
x[x.length - 1 - i] = temp;
}
你真正嘗試任何事情 - 谷歌甚至?我不是粗魯,但這顯然是一個家庭作業問題,我們不在這裏爲你做 – LordWilmore
@SeanLeBlanc好的。 – beaker