q3-1からq3-3まで完了

This commit is contained in:
2026-09-11 15:11:18 +09:00
parent a6152d2a13
commit 1701ab4e84
6 changed files with 39 additions and 7 deletions

6
Question03-if/.classpath Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

1
Question03-if/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/bin/

17
Question03-if/.project Normal file
View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Question03-if</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@@ -7,10 +7,11 @@
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("条件に合致しました");
}
}

View File

@@ -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("不合格です");
}
// ※ 合格です と表示されれば正解
}
}

View File

@@ -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でも割り切れます。");
}
}