q4-1からq4-4まで完了

This commit is contained in:
2026-09-11 16:05:20 +09:00
parent eb3936ce2d
commit 2c25236ae7
6 changed files with 55 additions and 4 deletions

View File

@@ -16,10 +16,17 @@ public class PTra04_01 {
// 以下のwhile文は0~9のランダムな値をコンソールに出力する処理を無限に繰り返します。
// TODO while文の条件を修正して5が出力されたら繰り返しを止めるようにしてください。
while(true) {
// 0~9のランダムな値を生成
randomNumber = random.nextInt(10);
// 生成した値をコンソールに出力
System.out.println(randomNumber);
boolean isOver = (randomNumber == 5);
if(isOver) {
break;
}
}
}