📜  fizzbuzz java代码示例

📅  最后修改于: 2022-03-11 14:52:22.249000             🧑  作者: Mango

代码示例1
public static String fizzBuzz(int number) {
        if (number % 3 == 0) {
            if (number % 5 == 0) {
                return "fizzbuzz";
            } else {
                return "fizz";
            }
        } else if (number % 5 == 0) {
            return "buzz";
        }
        return String.valueOf(number);
    }