Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 13th, 2012  |  syntax: None  |  size: 0.42 KB  |  hits: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5. package com.crimsonrpg.professions;
  6.  
  7. /**
  8.  *
  9.  * @author simplyianm
  10.  */
  11. public class Blah {
  12.         public static void main(String[] args) {
  13.                 int a = 0;
  14.                 int b = 1;
  15.                 int c = 0;
  16.                 int sum = 0;
  17.                
  18.                 while (c < 4000000) {
  19.                         c = a + b;
  20.                         a = b;
  21.                         b = c;
  22.                         if (c % 2 == 0) {
  23.                                 sum += c;
  24.                         }
  25.                 }
  26.                
  27.                 System.out.println(sum);
  28.         }
  29. }