Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Project Euler #2
//Title of this code //'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_45 import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]) { int sum = 0; int count = 1; int countB = 2; while (count < 4000000) { if ((count%2==0)&&(countB%2==0)){ sum =+ count + countB; } else if (count%2==0) { sum+= count; } else if (countB%2==0) { sum+=countB; } System.out.println("SUM: "+sum); //System.out.println("count: "+count); count += countB; System.out.println("count2: "+count); countB += count; System.out.println("countB: "+countB); } System.out.println(sum); } }
run
|
edit
|
history
|
help
0
Firstproject
String is not reference Type??
x by stars
Hello, World!
classwork
Java Variable
Java Object Graph Dumper (iterative)
PE #8
different ways to add parenthesis leetcode #241
[a-zA-Z ]{0,12}