Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class FizzBuzz {
- public static void main(String[] args) {
- IntStream.rangeClosed(1, 100).mapToObj(n ->
- (n % 15 == 0) ? "FizzBuzz" :
- (n % 3 == 0) ? "Fizz" :
- (n % 5 == 0) ? "Buzz" :
- String.valueOf(n))
- .collect(Collectors.toList()).forEach(System.out::println);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement