q4-1からq4-4まで完了
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user