package aRray;
import java.util.*;
public class newArrangeNumber {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int size = scan.nextInt();
int start = 0;
int end = size-1;
int arr [ ] = new int [size];
//this is basically index
for(int value = 1; start <= end; value++) {
if(value % 2 == 1) {
arr [start] = value;
start++;
}
else {
arr[end] = value;
end --;
}
}
for(int i = 0; i < size ; i++) {
System.out.println(arr[i]);
}
}
}
Comments
Post a Comment