Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- nt counter = 1;
- int total = 0;
- while(counter < 1000){
- if(counter % 3 == 0){
- total += counter;
- }
- if(counter % 5 == 0){
- total += counter;
- }
- if(counter % 5 == 0 && counter % 3 == 0){
- total -= counter;
- }
- counter += 1;
- }
- System.out.println(total);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement