Created
April 15, 2017 07:31
-
-
Save kunst1080/f1fd8e8797ca7d05def3cc5c3136e1b8 to your computer and use it in GitHub Desktop.
Java FizzBuzz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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