Massivning birinchi va ikkinchi yarmini almashtiring, masalan, 1 2 3 4 qator uchun, natijada 3 4 1 2
3-topshiriq
public class MassivTest {
public static void main(String args[]){
int a[] = {1,2,3,4};
int b[] = new int[a.length];
for (int i=0;iSystem.out.print(a[a.length/2+i]);
}
for (int i=0;iSystem.out.print(a[i]);
}
}
}
Do'stlaringiz bilan baham: |