Skip to content

Instantly share code, notes, and snippets.

@kunst1080
Created April 15, 2017 07:31
Show Gist options
  • Save kunst1080/f1fd8e8797ca7d05def3cc5c3136e1b8 to your computer and use it in GitHub Desktop.
Save kunst1080/f1fd8e8797ca7d05def3cc5c3136e1b8 to your computer and use it in GitHub Desktop.
Java FizzBuzz
import java.util.stream.IntStream;
public class Main {
public static void main(String[] args) {
IntStream.range(1, 100).boxed()
.map(n -> n % 15 == 0 ? "FizzBuzz"
: n % 5 == 0 ? "Buzz"
: n % 3 == 0 ? "Fizz"
: n)
.forEach(System.out::println);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment