blob: 6fb1f19a8bda1aa43099256b9454f1e31e252035 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
import java.util.Scanner;
class Main{
public static void main(String[] args) {
Scanner sc = new Scanner (System.in);
System.out.println("enter size of square, must be odd");
int size = sc.nextInt();
while(size % 2 == 0){
System.out.println("not odd");
size = sc.nextInt();
}
MagicSquare mSquare = new MagicSquare(size);
int[][] sq = mSquare.mSquare;
for (int i = 0; i < sq.length; i++){
for(int j = 0; j < sq[i].length; j++){
System.out.print(sq[i][j] + " ");
}
System.out.println();
}
}
}
|