need help in an assignment
here is what i got so far! after this im having a hard time figuring it out!
here is my code:
public class Start {
public static void main(String [] args){
Scanner sc = new Scanner(System.in);
int num = 1;
int input;
System.out.println("Enter number:");
input = sc.nextInt();
int limit = input;
int a = input/2;
int b = 0;
int [][] arr = new int[input][input];
do{
for( num = 1; num<=limit; num++){
if(arr[b][a]==0){
arr[b][a] = num;
if(b == 0){
b = input;
}
if(a == input -1){
a=-1;
}
a = a+1;
b = b-1;
}
else{
b=b+2;
a = a-1;
}
if(b == input){
b = 0;
}
if(b > input){
b =1;
}
if(a == -1){
a = input-1;
}
arr[b][a] = num;
}
num++;
}while(num <= limit);
for(int x =0;x<input;x++){
for(int y = 0;y<input;y++){
System.out.print(arr[x][y]);
}
System.out.println(" ");
}
}
}