Skip to main content
added 1 character in body
Source Link
a spaghetto
  • 11.3k
  • 3
  • 46
  • 82

Java, 290 bytes

class C{public static void main(String[]p){String b=" bottle",s=b+"s",o=" of beer",w=o+" on the wall",c=", ",n=".\n",u;for(int i=99;i>0;){u=i>2?s:b;System.out.println(i+s+w+c+i--+s+o+n+(i>0?"Take one down and pass it around, "+i+u:"Go to the store and buy some more, 99"+b+"s")+w+n);s=u;}}}

degolfedUngolfed:

class C {
    public static void main(String[] p) {
        String b = " bottle", s = b + "s", o = " of beer", w = o + " on the wall", c = ", ", n = ".\n", u;
        for (int i = 99; i > 0;) {
           u = i > 2 ? s : b;
           System.out.println(i + s
             + w
             + c
             + i--
             + s
             + o
             + n
             + (i > 0 ? "Take one down and pass it around, " + i + u
                 : "Go to the store and buy some more, 99" + b + "s") + w + n);
           s = u;
        }
    }
}

Java, 290 bytes

class C{public static void main(String[]p){String b=" bottle",s=b+"s",o=" of beer",w=o+" on the wall",c=", ",n=".\n",u;for(int i=99;i>0;){u=i>2?s:b;System.out.println(i+s+w+c+i--+s+o+n+(i>0?"Take one down and pass it around, "+i+u:"Go to the store and buy some more, 99"+b+"s")+w+n);s=u;}}}

degolfed

class C {
    public static void main(String[] p) {
        String b = " bottle", s = b + "s", o = " of beer", w = o + " on the wall", c = ", ", n = ".\n", u;
        for (int i = 99; i > 0;) {
           u = i > 2 ? s : b;
           System.out.println(i + s
             + w
             + c
             + i--
             + s
             + o
             + n
             + (i > 0 ? "Take one down and pass it around, " + i + u
                 : "Go to the store and buy some more, 99" + b + "s") + w + n);
           s = u;
        }
    }
}

Java, 290 bytes

class C{public static void main(String[]p){String b=" bottle",s=b+"s",o=" of beer",w=o+" on the wall",c=", ",n=".\n",u;for(int i=99;i>0;){u=i>2?s:b;System.out.println(i+s+w+c+i--+s+o+n+(i>0?"Take one down and pass it around, "+i+u:"Go to the store and buy some more, 99"+b+"s")+w+n);s=u;}}}

Ungolfed:

class C {
    public static void main(String[] p) {
        String b = " bottle", s = b + "s", o = " of beer", w = o + " on the wall", c = ", ", n = ".\n", u;
        for (int i = 99; i > 0;) {
           u = i > 2 ? s : b;
           System.out.println(i + s
             + w
             + c
             + i--
             + s
             + o
             + n
             + (i > 0 ? "Take one down and pass it around, " + i + u
                 : "Go to the store and buy some more, 99" + b + "s") + w + n);
           s = u;
        }
    }
}
Source Link
Minimal
  • 141
  • 2

Java, 290 bytes

class C{public static void main(String[]p){String b=" bottle",s=b+"s",o=" of beer",w=o+" on the wall",c=", ",n=".\n",u;for(int i=99;i>0;){u=i>2?s:b;System.out.println(i+s+w+c+i--+s+o+n+(i>0?"Take one down and pass it around, "+i+u:"Go to the store and buy some more, 99"+b+"s")+w+n);s=u;}}}

degolfed

class C {
    public static void main(String[] p) {
        String b = " bottle", s = b + "s", o = " of beer", w = o + " on the wall", c = ", ", n = ".\n", u;
        for (int i = 99; i > 0;) {
           u = i > 2 ? s : b;
           System.out.println(i + s
             + w
             + c
             + i--
             + s
             + o
             + n
             + (i > 0 ? "Take one down and pass it around, " + i + u
                 : "Go to the store and buy some more, 99" + b + "s") + w + n);
           s = u;
        }
    }
}