반응형
public class Main {

	public static void main(String[] args) {

		int a = 1, b = 2, temp = 0;

		int sum = 0;

		while (b <= 4000000) {

			if (b % 2 == 0) {

				sum = sum + b;

			}

			temp = a;

			a = b;

			b = temp + b;

		}

		System.out.println(sum);

	}

}
반응형

+ Recent posts