Return to Snippet

Revision: 32106
at September 18, 2010 07:49 by itaiferber


Initial Code
public class Euler {
    public static void main (String[] args) {
        int sum = 0;
        for (int counter = 1; counter < 1000; counter++) {
            if ((counter % 3) == 0 || (counter % 5) == 0) {
                sum += counter;
            }
        }

        System.out.print("The sum of all multiples of 3 and 5 below 1000 is " + sum + ".");
    }
}

Initial URL

                                

Initial Description
The solution to Project Euler [Problem 1](http://projecteuler.net/index.php?section=problems&id=1), written in Java as an example for my AP Computer Science class teaching internship.

Initial Title
Project Euler - Problem 1

Initial Tags
java

Initial Language
Java