Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 
 package net.sf.cotelab.euler;

A solution for Project Euler Problem 2. The problem statement is here.

Author(s):
Al Cote'
public class Problem02 {
The main method.

Parameters:
args unused.
	public static void main(String[] args) {
		int sum = 2;
		int older = 1;
		int old = 2;
		int newest;
		while ((newest = older + old) <= ) {
			if ((newest % 2) == 0) {
				sum += newest;
			}
			older = old;
			old = newest;
		}
		..println("sum = " + sum);
	}
	public static final int LIMIT = 4000000;
New to GrepCode? Check out our FAQ X