online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
import java.util.Scanner; public class Main { // A function to test if a number is prime, takes an integer and returns a // boolean. public static boolean isPrime(int n) { if (n < 2) { return false; } // Try dividing by all numbers from 2 to sqrt(n). for (int i = 2; i*i <= n; ++i) { if (n % i == 0) { return false; } } // If we get here, we didn't find a factor, so n is prime. return true; } // Main program starts here. public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("What is your name? "); String name = input.nextLine(); System.out.println("Hello, " + name + "!"); System.out.print("What is your favorite number? "); int number = input.nextInt(); System.out.print("Your favorite number is " + number); if (isPrime(number)) { System.out.println(", and that's a prime number!"); } else { System.out.println(". It's not a prime number, but that's okay!"); } } }

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