online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <stdio.h> /* A function to test if a number is prime, takes an integer and returns a * boolean. (We'll just use an int for the boolean) */ int isPrime(int n) { int i; if (n < 2) { return 0; } /* Try dividing by all numbers from 2 to sqrt(n). */ for (i = 2; i*i <= n; ++i) { if (n % i == 0) { return 0; } } /* If we get here, we didn't find a factor, so n is prime. */ return 1; } int main(void) { char name[100]; int number; printf("What is your name? (one word only please) "); scanf("%s", name); printf("Hello, %s!\n", name); printf("What is your favorite number? "); scanf("%d", &number); printf("Your favorite number is %d", number); if (isPrime(number)) { printf(", and that's a prime number!\n"); } else { printf(". It's not a prime number, but that's okay!\n"); } return 0; }

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