Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace FizzBuzz
- {
- class Program
- {
- static void Main(string[] args)
- {
- var matchers = new[]
- {
- new Tuple<int, string>(3, "Fizz"),
- new Tuple<int, string>(5, "Buzz"),
- };
- for (var i = 1; i <= 100; i++) {
- var matches = matchers.Where(c => i % c.Item1 == 0).ToList();
- if (matches.Any())
- foreach (var comb in matches)
- Console.Write(comb.Item2);
- else
- Console.Write(i);
- Console.Write(Environment.NewLine);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment