Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Prob1 {
- public static void main(String[ ] args) {
- int sum = 0;
- for (int i = 0; i < 1000; i++) {
- sum += (i % 3 == 0 || i % 5 == 0) ? i : 0;
- }
- System.out.println(sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment