Files
java-question/Question02-Expressions/src/PTra02_01.java
2026-09-11 16:12:12 +09:00

36 lines
1.1 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* PTra02_01.java
* 作成 Rhizome
*------------------------------------------------------------
* Copyright(c) Rhizome Inc. All Rights Reserved.
*/
public class PTra02_01 {
public static void main(String[] args) {
int sum;
int diff;
int mulch;
int div;
int rem;
// TODO 6+2を計算して結果を変数sumに代入してください
sum = 6 + 2;
// TODO 6-2を計算して結果を変数diffに代入してください
diff = 6 -2;
// TODO 6×2を計算して結果を変数mulchに代入してください
mulch = 6 * 2;
// TODO 6÷2を計算して結果を変数divに代入してください
div = 6 / 2;
// TODO 17÷5の余りを計算して変数remに代入してください
rem = 17 % 5;
// 各変数の表示(編集しないでください)
// ※ 8, 4, 12, 3, 2の順で表示されれば正解です
System.out.println("変数sum :" + sum);
System.out.println("変数diff :" + diff);
System.out.println("変数mulch:" + mulch);
System.out.println("変数div :" + div);
System.out.println("変数rem :" + rem);
}
}