Menu

[r9]: / Chapter 1 Code / PoolPuzzle.java  Maximize  Restore  History

Download this file

26 lines (24 with data), 447 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
public class PoolPuzzle {
public static void main(String[] args) {
int x = 0;
while (x < 4) {
System.out.print("a");
if (x < 1) {
System.out.print(" ");
}
System.out.print("n");
if (x < 1) {
System.out.print("oise");
x = x - 1;
}
if (x == 1) {
System.out.print("noys");
}
if (x > 1) {
System.out.print(" oyster");
}
System.out.println("");
x = x + 2;
}
}
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.