Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
23
Task/FizzBuzz/C-sharp/fizzbuzz-4.cs
Normal file
23
Task/FizzBuzz/C-sharp/fizzbuzz-4.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
|
||||
namespace FizzBuzz
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
Enumerable.Range(1, 100)
|
||||
.GroupBy(e => e % 15 == 0 ? "FizzBuzz" : e % 5 == 0 ? "Buzz" : e % 3 == 0 ? "Fizz" : string.Empty)
|
||||
.SelectMany(item => item.Select(x => new {
|
||||
Value = x,
|
||||
Display = String.IsNullOrEmpty(item.Key) ? x.ToString(CultureInfo.InvariantCulture) : item.Key
|
||||
}))
|
||||
.OrderBy(x => x.Value)
|
||||
.Select(x => x.Display)
|
||||
.ToList()
|
||||
.ForEach(Console.WriteLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue