Solution to the FizzBuzz Problem

What we came up with looks something like this:

private object FizzBuzz(int value)
{
if (value % 15 == 0)
return "FizzBuzz";

if (value % 5 == 0)
return "Buzz";

if (value % 3 == 0)
return "Fizz";

return value;
}

Don't worry if you chose to solve the problem a different way. The important thing is that you gained knowledge and understanding during this exercise. Additionally, you now have a comprehensive set of tests and you're comfortable refactoring and/or adding functionality.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.157.106