Created
October 5, 2020 16:30
-
-
Save oliverbooth/0e83a8e6ecc3c06720941035cc42ff86 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void Main() { | |
FizzBuzz(100, new[]{("Fizz",3),("Buzz",5)}); | |
} | |
public static void FizzBuzz(int c, (string,int)[] d) { | |
bool f(int n, int d)=>n%d==0; | |
for (int i=1;i<=c;i++) { | |
bool p=false; | |
for (int m=0;m<d.Length;m++) { | |
if(f(i,d[m].Item2)) { | |
Console.Write(d[m].Item1); | |
p=true; | |
} | |
} | |
if(!p) Console.Write(i); | |
Console.WriteLine(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Readable version: