Skip to content

Instantly share code, notes, and snippets.

@macalinao
Created December 18, 2011 01:13
Show Gist options
  • Save macalinao/1492020 to your computer and use it in GitHub Desktop.
Save macalinao/1492020 to your computer and use it in GitHub Desktop.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.crimsonrpg.professions;
/**
*
* @author simplyianm
*/
public class Blah {
public static void main(String[] args) {
int a = 0;
int b = 1;
int c = 0;
int sum = 0;
while (c < 4000000) {
c = a + b;
a = b;
b = c;
if (c % 2 == 0) {
sum += c;
}
}
System.out.println(sum);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment