Java
public class Bottle {
public static void main(String Argv[]) {
for(int i=99; iɬ i--) {
String b = b(i);
System.out.println(b + " on the wall, "
+ b + ".\n"
+ "Take one down and pass it around, "
+ b(i-1) + " on the wall.");
}
}
static String b(int n) {
String s = "s"; if (n == 1) s = "";
return n + " bottle" + s + " of beer";
}
}
Previous slide
Next slide
Back to first slide
View graphic version