Question04-03
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
|
||||
/*
|
||||
* PTra04_03.java
|
||||
* 作成 Rhizome
|
||||
@@ -16,12 +17,17 @@ public class PTra04_03 {
|
||||
// 以下のwhile文は0~9のランダムな値をコンソールに出力する処理を無限に繰り返します。
|
||||
// TODO 5が出力されたら繰り返しを止めるようにしてください。
|
||||
// ※ while文の条件は変更せずにbreak文を使ってください。
|
||||
while(true) {
|
||||
while (true) {
|
||||
// 0~9のランダムな値を生成
|
||||
randomNumber = random.nextInt(10);
|
||||
|
||||
// 生成した値をコンソールに出力
|
||||
System.out.println(randomNumber);
|
||||
|
||||
if (randomNumber == 5) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
System.out.println("処理が終了しました");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user