Java :: Aufgabe #43 :: Lösung #5

6 Lösungen Lösungen öffentlich
#43

99 Bottles of Beer - Selbstständige Lösung

Anfänger - Java von pocki - 11.01.2013 um 14:07 Uhr
Programmiere eine eigenständige Lösung zur gängigen Programmier-Übung bzw. Lied 99 Bottles of Beer

Ausgabe:

Konsolenausgabe:


99 bottles of beer on the wall, 99 bottles of beer.
Take one down and pass it around, 99 bottles of beer on the wall.

98 bottles of beer on the wall, 98 bottles of beer.
... usw.
#5
vote_ok
von Bufkin (1410 Punkte) - 16.08.2017 um 14:51 Uhr
Quellcode ausblenden Java-Code
class Test
 {
     
     public static void bottles() {
         
         for(int zaehler = 99; zaehler > 1; zaehler--) {
            System.out.println(zaehler + " bottles of beer on the wall, " + zaehler + " bottles of beer.\nTake one down and pass it around, " + zaehler + " bottles of beer on the wall.\n");
        }
         
        System.out.println("One last bottle of beer on the wall, one last bottle of beer.\nTake it down, pass it around, no more bottles of beer on the wall.");
         
     }
     
     public static void main (String[] args) throws java.lang.Exception
     {
         bottles();
     }
}

Kommentare:

Für diese Lösung gibt es noch keinen Kommentar

Bitte melden Sie sich an um eine Kommentar zu schreiben.
Kommentar schreiben