From 3d3eebaf77fc06cc9216294701d662f3e9a77933 Mon Sep 17 00:00:00 2001 From: CoRock Date: Wed, 26 Dec 2018 17:46:35 +0900 Subject: [PATCH 1/6] Update classpath --- .classpath | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.classpath b/.classpath index 51a8bba..2306e32 100644 --- a/.classpath +++ b/.classpath @@ -1,6 +1,6 @@ - + From 3a01c0ccffd16e48bb50106c95a5f9fbac2574c2 Mon Sep 17 00:00:00 2001 From: CoRock Date: Wed, 26 Dec 2018 23:08:46 +0900 Subject: [PATCH 2/6] Add Prob1.java --- src/practice01/Prob1.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/practice01/Prob1.java b/src/practice01/Prob1.java index c038781..855f129 100644 --- a/src/practice01/Prob1.java +++ b/src/practice01/Prob1.java @@ -5,7 +5,16 @@ public class Prob1 { public static void main(String[] args) { Scanner scanner = new Scanner( System.in ); + int num = 0; + System.out.print("수를 입력하시오 : "); + num = scanner.nextInt(); + + if (num != 0 && num % 3 == 0) { + System.out.println("3의 배수입니다."); + return; + } + System.out.println("3의 배수가 아닙니다."); scanner.close(); } From 42362954ff0eb50f61436a9b80c89ff7e1494716 Mon Sep 17 00:00:00 2001 From: CoRock Date: Wed, 26 Dec 2018 23:14:08 +0900 Subject: [PATCH 3/6] Add Prob2.java --- src/practice01/Prob2.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/practice01/Prob2.java b/src/practice01/Prob2.java index 32d40f0..7fc4463 100644 --- a/src/practice01/Prob2.java +++ b/src/practice01/Prob2.java @@ -1,6 +1,15 @@ package practice01; public class Prob2 { + public static void main(String[] args) { + for (int i = 1; i < 10; i++) { + for (int j = 0; j < 10; j++) { + System.out.print(i + j); + System.out.print(" "); + } + System.out.println(); + } } + } From 80aab0d3440f1b2e5a08bd3db4c09af0b8aa6443 Mon Sep 17 00:00:00 2001 From: CoRock Date: Wed, 26 Dec 2018 23:22:18 +0900 Subject: [PATCH 4/6] Add Prob3.java --- src/practice01/Prob3.java | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/practice01/Prob3.java b/src/practice01/Prob3.java index 3b7ab3c..b6507ae 100644 --- a/src/practice01/Prob3.java +++ b/src/practice01/Prob3.java @@ -1,7 +1,30 @@ package practice01; +import java.util.Scanner; + public class Prob3 { public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + + int num = 0; + int sum = 0; + + System.out.print("숫자를 입력하세요: "); + num = sc.nextInt(); + + // if num is even + if (num % 2 == 0) { + for (int i = 0; i <= num; i += 2) { + sum += i; + } + } else { + for (int i = 1; i <= num; i += 2) { + sum += i; + } + } + System.out.print("결과 값 : "); + System.out.println(sum); } + } From 1f17d15f735fc1bebf082aead01ce2488c13759c Mon Sep 17 00:00:00 2001 From: CoRock Date: Wed, 26 Dec 2018 23:35:10 +0900 Subject: [PATCH 5/6] Add Prob4.java --- src/practice01/Prob4.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/practice01/Prob4.java b/src/practice01/Prob4.java index 7d38c33..ed59731 100644 --- a/src/practice01/Prob4.java +++ b/src/practice01/Prob4.java @@ -1,9 +1,21 @@ package practice01; +import java.util.Scanner; public class Prob4 { public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + String str = null; + int pointer = 1; + + System.out.print("문자열을 입력하세요. : "); + str = sc.nextLine(); + + for (int i = 0; i < str.length(); i++) { + System.out.println(str.substring(0, pointer)); + pointer++; + } } } From 9550d90247c746bcb2b4196366161fa4003a310b Mon Sep 17 00:00:00 2001 From: CoRock Date: Thu, 27 Dec 2018 00:03:25 +0900 Subject: [PATCH 6/6] Add Prob5.java --- src/practice01/Prob5.java | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/practice01/Prob5.java b/src/practice01/Prob5.java index d8d08ad..210efc9 100644 --- a/src/practice01/Prob5.java +++ b/src/practice01/Prob5.java @@ -3,5 +3,40 @@ public class Prob5 { public static void main(String[] args) { + String clapNum = null; + int clapCount = 0; + int tenDigit; + int unitsDigit; + + // if number is the units of digit + for (int i = 1; i < 10; i++) { + clapNum = i + ""; + tenDigit = clapNum.charAt(0); + + if (tenDigit == '3' || tenDigit == '6' || tenDigit == '9') { + System.out.println(tenDigit - 48 + " 짝"); + } + } + + // if number is the ten of digit + for (int i = 10; i < 100; i++) { + clapNum = i + ""; + clapCount = 0; + + tenDigit = clapNum.charAt(0); + unitsDigit = clapNum.charAt(1); + + if (unitsDigit == '3' || unitsDigit == '6' || unitsDigit == '9') { + clapCount++; + } + + if (tenDigit == '3' || tenDigit == '6' || tenDigit == '9') { + clapCount++; + } + + if (clapCount == 1) { System.out.println(clapNum + " 짝"); } + if (clapCount == 2) { System.out.println(clapNum + " 짝짝"); } + } } + }