online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
// A function to test if a number is prime, takes an integer and returns a // boolean. func isPrime(_ n: Int) -> Bool { if n < 2 { return false } // Try dividing by all numbers from 2 to sqrt(n). var i = 2 while i*i <= n { if n % i == 0 { return false } i += 1 } // If we get here, we didn't find a factor, so n is prime. return true } // Main program starts here. print("What is your name? ", terminator: "") let name = readLine()! print("Hello, \(name)!") print("What is your favorite number? ", terminator: "") let number = Int(readLine()!)! print("Your favorite number is \(number)", terminator: "") if isPrime(number) { print(", and that's a prime number!") } else { print(". 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