C :: Aufgabe #32 :: Lösung #3

3 Lösungen Lösungen öffentlich
#32

99 Bottles of Beer - Selbstständige Lösung

Anfänger - C 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.
#3
vote_ok
von kathleenw (3600 Punkte) - 09.07.2020 um 10:21 Uhr
Quellcode ausblenden C-Code
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    int i;
    
    for (i=99;i>0;i--) {
        if (i==1)
            printf("%d bottle of beer on the wall, %d bottle of beer.\nTake one down and pass it around, %d bottle of beer.\n\n",i,i,i);
        else
            printf("%d bottles of beer on the wall, %d bottles of beer.\nTake one down and pass it around, %d bottles of beer.\n\n",i,i,i);
    }
    
    return EXIT_SUCCESS;
}

Kommentare:

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

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