DEV Community

Discussion on: Project Euler #1 - Multiples of 3 and 5

Collapse
 
alainvanhout profile image
Alain Van Hout

In Java

    final int sum = IntStream.range(0, 1000)
            .filter(x -> x % 3 == 0 || x % 5 == 0)
            .sum();
    System.out.println(sum);