Advertisement
dandan43

Untitled

Nov 26th, 2014
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. nt counter = 1;
  2. int total = 0;
  3.  
  4. while(counter < 1000){
  5. if(counter % 3 == 0){
  6. total += counter;
  7. }
  8. if(counter % 5 == 0){
  9. total += counter;
  10. }
  11. if(counter % 5 == 0 && counter % 3 == 0){
  12. total -= counter;
  13. }
  14. counter += 1;
  15. }
  16.  
  17. System.out.println(total);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement