Who knows the nursery rhyme Ten Green Bottles?
Lyrics:
Ten green bottles hanging on the wall,
Ten green bottles hanging on the wall,
And if one green bottle should accidentally fall,
There'll be nine green bottles hanging on the wall.
Nine green bottles hanging on the wall,
Nine green bottles hanging on the wall,
And if one green bottle should accidentally fall,
There'll be eight green bottles hanging on the wall.
Eight green bottles hanging on the wall...
Seven green bottles hanging on the wall...
...
One green bottle hanging on the wall,
One green bottle hanging on the wall,
If that one green bottle should accidentally fall,
There'll be no green bottles hanging on the wall.
Write some amazing code to reproduce the above lyrics starting from n
green bottles!
- parameter
n
is 1 to 10 - newline terminates every line (including the last)
- don't forget the blank lines between the verses