Advertisement
Guest User

SOMETHING

a guest
Apr 27th, 2020
170
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Main
  2. {
  3.     public static void main()
  4.     {
  5.         int sum = 0;
  6.         for (int i = 0; i < 1000; i+=3)
  7.         {
  8.             sum += i;
  9.         }
  10.         for (int i = 0; i < 1000; i+=5)
  11.         {
  12.             sum += i;
  13.         }
  14.         for (int i = 0; i < 1000; i+= 15)
  15.         {
  16.             sum -= i;
  17.         }
  18.         System.out.println("Answer: " + sum);
  19.     }
  20. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement