Skip to content

Instantly share code, notes, and snippets.

@cosminpopescu14
Created November 11, 2020 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cosminpopescu14/01cc159f9d53ed3ce11edab65a12674e to your computer and use it in GitHub Desktop.
Save cosminpopescu14/01cc159f9d53ed3ce11edab65a12674e to your computer and use it in GitHub Desktop.
package com.company;
import java.util.stream.IntStream;
public class FizzBuzz {
public static void main(String[] args) {
IntStream.range(1, 100)
.mapToObj( x -> x % 15 == 0 ? "FizzBuzz" : x % 5 == 0 ? "Buzz" : x % 3 == 0 ? "Fizz" : x)
.forEach(System.out::println);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment