From 394fc0b86e699b9cd5cc6bcb4b9d06cc0d944c1f Mon Sep 17 00:00:00 2001 From: kim_yubin Date: Sun, 23 Dec 2018 20:04:39 +0900 Subject: [PATCH] =?UTF-8?q?=EC=B6=94=EA=B0=80=20'=EC=88=AB=EC=9E=90?= =?UTF-8?q?=EB=86=80=EC=9D=B4'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 숫자놀이 | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 숫자놀이 diff --git a/숫자놀이 b/숫자놀이 new file mode 100644 index 0000000..150acf4 --- /dev/null +++ b/숫자놀이 @@ -0,0 +1,41 @@ +package AlgorythmTest; + +import java.util.Scanner; + +public class AlgorythmTest1 { + + public static void main(String[] args) { + + Scanner s = new Scanner(System.in); + System.out.println("써 : "); + int num = Integer.parseInt(s.nextLine()); + + int a = 1; + int check = 0; + int[][] list = new int[num][num]; + + for (int k = 0; k < num; k++) { + for (int i = 0; i < num; i++) { + list[k][i] = a; + a++; + System.out.print(list[k][i] + " "); + } + } + + System.out.println(""); + + int x = num - 1; + + for (int j = 0; j < num; j++) { + for (int m = 0; m < num; m++) { + if (j % 2 == 0) + System.out.print(list[j][x--] + " "); + else if (j % 2 == 1) + System.out.print(list[j][++x] + " "); + + } // 321 456 987 + } + + } + +}