online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
// class Goldbach{ public static void main(String[] args){ // for (int i= 0; i<20;i++) System.out.println(i + ": " + esPrimo(i)); // CP // for (int i= 0; i<20;i++) goldbach(i); // casos de prueba // CP goldbach(22); } static void goldbach(int n){ if (n%2 != 0) {System.out.println("n = " + n + " no es par"); return;} // P1 if (n <4) {System.out.println("n = " + n + " < 4"); return;} System.out.print("Goldbach: " + n + " = " ); int p = 2; // primer primo while(p<=n/2){ if(esPrimo(p) && esPrimo(n-p)) { System.out.println(p + " + " + (n-p)); return; } if(p==2) p++; // optimización de la iteración else p +=2; }; System.out.println("No se cumple GoldBach"); } static boolean esPrimo(int n){ // algoritmo óptimo if (n < 2) return false; if (n == 2) return true; if (n%2 == 0) return false; for (int i = 3; i < n / 2; i +=2) if (n % i == 0) return false; // // algoritmo óptimo return true; } }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue