q3-1からq3-3まで完了
This commit is contained in:
6
Question03-if/.classpath
Normal file
6
Question03-if/.classpath
Normal 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
1
Question03-if/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/bin/
|
||||
17
Question03-if/.project
Normal file
17
Question03-if/.project
Normal 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>
|
||||
@@ -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("条件に合致しました");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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("不合格です");
|
||||
|
||||
}
|
||||
// ※ 合格です と表示されれば正解
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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でも割り切れます。");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user