online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
import java.util.*; public class Main { static int countDigit (long n) { int count = 0; while (n != 0) { n = n / 10; ++count; } return count; } public static int prime (int n) { if (n == 1 || n == 0) return 0; else if (n == 2) return 0; else if (n % 2 == 0) return n; for (int i = 3; i <= Math.sqrt (n); i += 2) { if (n % i == 0) return n; } return 0; } public static void main (String[]args) { int sum = 0; int arr[] = new int[100]; Scanner sc = new Scanner (System.in); int n = sc.nextInt (); int size = countDigit (n); for (int i = 0; i < size; i++) { if (n > 0) { arr[i] = n % 10; n = n / 10; } } for (int i = 0; i < size; i++) { sum += prime (arr[i]); } System.out.println (sum); } }

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