C :: Aufgabe #32 :: Lösung #2
3 Lösungen
#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:
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.
#2
von DBqFetti (2480 Punkte)
- 07.02.2015 um 17:50 Uhr
Welch Fummelei mit der Grammatik :D
C-Code
#include <stdio.h>
#include <conio.h>
void main(){
for(int i = 99; i > 0; i--){
printf("%i%s bottle%s of beer on the wall, %i%s bottle%s of beer.\nTake one down and pass it around, ", i, i == 1 ? " last": "", i > 1 ? "s" : "", i, i == 1 ? " last" : "", i > 1 ? "s" : "");
printf(i == 1 ? "no more" : "%i", i-1);
printf("%s bottle%s of beer on the wall.\n\n", i-1 == 1 ? " last" : "", i-1 == 1 ? "" : "s");
}
_getch();
}
Kommentare:
Für diese Lösung gibt es noch keinen Kommentar
Seite 1 von 0
1
