99 bottles of beer: Difference between revisions
Content added Content deleted
(→{{header|Go}}: task conformance + lang tag) |
(→Another Implementation using Linq: Removed extra copy of C# Linq solution) |
||
Line 851: | Line 851: | ||
Console.WriteLine(item); |
Console.WriteLine(item); |
||
} |
} |
||
} |
|||
}</lang> |
|||
<lang csharp>using System; |
|||
using System.Linq; |
|||
class Program |
|||
{ |
|||
static void Main() |
|||
{ |
|||
Enumerable.Range(0,100) |
|||
.Reverse() |
|||
.Select(total => total > 0 |
|||
? string.Format("{0} bottles of beer on the wall\n{0} bottles of beer\nTake one down, pass it around", total) |
|||
: string.Format("{0} bottles left", total)) |
|||
.ToList() |
|||
.ForEach(s => Console.WriteLine(s)); |
|||
} |
} |
||
}</lang> |
}</lang> |