From 1701ab4e8478a4cbfa1f0c92be729228f51ec6a0 Mon Sep 17 00:00:00 2001 From: a-takayama <26-a-takayama-scm@it-college.co.jp> Date: Fri, 11 Sep 2026 15:11:18 +0900 Subject: [PATCH] =?UTF-8?q?q3-1=E3=81=8B=E3=82=89q3-3=E3=81=BE=E3=81=A7?= =?UTF-8?q?=E5=AE=8C=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Question03-if/.classpath | 6 ++++++ Question03-if/.gitignore | 1 + Question03-if/.project | 17 +++++++++++++++++ Question03-if/src/PTra03_01.java | 7 ++++--- Question03-if/src/PTra03_02.java | 11 +++++++++-- Question03-if/src/PTra03_03.java | 4 ++-- 6 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 Question03-if/.classpath create mode 100644 Question03-if/.gitignore create mode 100644 Question03-if/.project diff --git a/Question03-if/.classpath b/Question03-if/.classpath new file mode 100644 index 0000000..0cbf9cd --- /dev/null +++ b/Question03-if/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/Question03-if/.gitignore b/Question03-if/.gitignore new file mode 100644 index 0000000..ae3c172 --- /dev/null +++ b/Question03-if/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/Question03-if/.project b/Question03-if/.project new file mode 100644 index 0000000..e8642b6 --- /dev/null +++ b/Question03-if/.project @@ -0,0 +1,17 @@ + + + Question03-if + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/Question03-if/src/PTra03_01.java b/Question03-if/src/PTra03_01.java index fb0aab1..f902940 100644 --- a/Question03-if/src/PTra03_01.java +++ b/Question03-if/src/PTra03_01.java @@ -6,11 +6,12 @@ */ public class PTra03_01 { public static void main(String[] args) { - + + int num = 100; // TODO int型の変数numを宣言し、100で初期化してください - + //boolean bool = (100 == num); // TODO「変数numが100である」という条件式を追加してください - if () { + if (num == 100) { System.out.println("条件に合致しました"); } } diff --git a/Question03-if/src/PTra03_02.java b/Question03-if/src/PTra03_02.java index 776b96c..646e4e3 100644 --- a/Question03-if/src/PTra03_02.java +++ b/Question03-if/src/PTra03_02.java @@ -7,9 +7,16 @@ public class PTra03_02 { public static void main(String[] args) { // TODO int型の変数numを宣言し、65で初期化してください - + int num = 65; // TODO 変数numの値が65以上の場合は「合格です」と出力し、それ以外であれば「不合格です」を出力してください - // ※ 合格です と表示されれば正解 + if(num >= 65) { + System.out.println("合格です"); + } + else { + System.out.println("不合格です"); + + } + // ※ 合格です と表示されれば正解 } } diff --git a/Question03-if/src/PTra03_03.java b/Question03-if/src/PTra03_03.java index 511a3cb..6daf02d 100644 --- a/Question03-if/src/PTra03_03.java +++ b/Question03-if/src/PTra03_03.java @@ -7,9 +7,9 @@ public class PTra03_03 { public static void main(String[] args) { int num = 10; - + //num = (int)(num / 2 && num / 5); // TODO numが 2で割り切れる かつ 5で割り切れるという条件式を記述してください - if () { + if (num % 2 == 0&& num % 5 ==0) { System.out.println(num + "は2でも5でも割り切れます。"); } }