123456789101112131415161718192021222324 |
-
- /**
- * Write a description of class FizzBuzz here.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class FizzBuzz
- {
- public String of(int x) {
- String fizz = "";
- if (x % 3 == 0 && x % 5 == 0) {
- fizz = "FizzBuzz";
- } else if (x % 3 == 0) {
- fizz = "Fizz";
- } else if (x % 5 == 0) {
- fizz = "Buzz";
- } else {
- fizz = "" + x;
- }
- return fizz;
- }
- }
|