eniallator

Project Euler | Problem 1

Sep 26th, 2018
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.24 KB | None | 0 0
  1. public class Prob1 {
  2.     public static void main(String[ ] args) {
  3.         int sum = 0;
  4.  
  5.         for (int i = 0; i < 1000; i++) {
  6.             sum += (i % 3 == 0 || i % 5 == 0) ? i : 0;
  7.         }
  8.  
  9.         System.out.println(sum);
  10.     }
  11. }
Advertisement
Add Comment
Please, Sign In to add comment