Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Prob2 {
- public static void main(String[ ] args) {
- int a = 0;
- int b = 1;
- int sum = 0;
- while (b < 4000000) {
- sum += (b & 1) == 0 ? b : 0;
- int temp = a;
- a = b;
- b = temp + b;
- }
- System.out.println(sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment