Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Copyright Daniel 2k14 (year of the rapture)
- // Jordan is the bae
- public class app {
- public static void main(String[] args) {
- int i;
- int sum = 0;
- int sequence[] = new int[3];
- sequence[0] = 1;
- sequence[1] = 1;
- while(sequence[0] + sequence[1] < 4000000){
- sequence[2] = sequence[1] + sequence[0];
- if(sequence[0] > sequence[1]) {
- sequence[1] = sequence[2];
- }
- else {
- sequence[0] = sequence[2];
- }
- System.out.println(sequence[2]);
- if (sequence[2] % 2 == 0) {
- sum += sequence[2];
- }
- }
- System.out.println(sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement