Ad
Code
Diff
  • using System;
    
    namespace Solution {
    
      class FizzBuzz {
        public static Func<int, string> convert = (input) 
                => {
                  var output = $"{input % 3 == 0 ? "Fizz" : string.Empty}{input % 5 == 0 ? "Buzz" : string.Empty}";
                  return !string.IsNullOrWhiteSpace(output) ? output : input.ToString();
                };
      }
    }
    • using System;
    • namespace Solution {
    • class FizzBuzz {
    • public static string convert(int input)
    • {
    • var output = (input % 3 == 0 ? "Fizz" : "") + (input % 5 == 0 ? "Buzz" : "");
    • return output == "" ? input.ToString() : output;
    • }
    • public static Func<int, string> convert = (input)
    • => {
    • var output = $"{input % 3 == 0 ? "Fizz" : string.Empty}{input % 5 == 0 ? "Buzz" : string.Empty}";
    • return !string.IsNullOrWhiteSpace(output) ? output : input.ToString();
    • };
    • }
    • }