LoginSignup
2
0

More than 5 years have passed since last update.

[Java]FizzBuzzCounter

Last updated at Posted at 2017-11-17

これってJava的には「ワンライナー」と言って良いのでしょうか?

FuzzBuzzCounter.java
    public static void main(String[] args) {
        LongStream.rangeClosed(1, Long.parseLong(args[0])).forEach(i -> System.out.println(((i % 3) == 0 ? "Fizz" + ((i % 5) == 0 ? "Buzz" : "") : ((i % 5) == 0 ? "Buzz" : i))));
    }

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0