(playing around with kumite)
for some this might be readable.
using System; namespace Solution { class FizzBuzz { public static string convert(int input) { bool divisableBy3 = (input % 3 == 0); bool divisableBy5 = (input % 5 == 0); if (!divisableBy3 & !divisableBy5) return input.ToString(); return (divisableBy3 ? "Fizz" : "") + (divisableBy5 ? "Buzz" : "");; } } }
- using System;
- namespace Solution {
- class FizzBuzz {
- public static string convert(int input)
- {
var output = "";output += (input % 3 == 0) ? "Fizz" : "";output += (input % 5 == 0) ? "Buzz" : "";output += (string.IsNullOrEmpty(output)) ? input.ToString() : "";return output;- bool divisableBy3 = (input % 3 == 0);
- bool divisableBy5 = (input % 5 == 0);
- if (!divisableBy3 & !divisableBy5)
- return input.ToString();
- return (divisableBy3 ? "Fizz" : "") + (divisableBy5 ? "Buzz" : "");;
- }
- }
- }