Advertisement
Guest User

Untitled

a guest
Aug 27th, 2014
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. // Copyright Daniel 2k14 (year of the rapture)
  2. // Jordan is the bae
  3.  
  4.  
  5.  
  6.  
  7.  
  8. public class app {
  9.  
  10. public static void main(String[] args) {
  11.  
  12. int i;
  13. int sum = 0;
  14.  
  15. int sequence[] = new int[3];
  16. sequence[0] = 1;
  17. sequence[1] = 1;
  18.  
  19. while(sequence[0] + sequence[1] < 4000000){
  20. sequence[2] = sequence[1] + sequence[0];
  21.  
  22.  
  23. if(sequence[0] > sequence[1]) {
  24. sequence[1] = sequence[2];
  25. }
  26. else {
  27. sequence[0] = sequence[2];
  28. }
  29.  
  30. System.out.println(sequence[2]);
  31.  
  32. if (sequence[2] % 2 == 0) {
  33. sum += sequence[2];
  34. }
  35.  
  36.  
  37.  
  38. }
  39.  
  40. System.out.println(sum);
  41.  
  42.  
  43.  
  44.  
  45. }
  46.  
  47.  
  48.  
  49.  
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement