Skip to content

Instantly share code, notes, and snippets.

@bragboy
Last active November 12, 2015 10:41
Show Gist options
  • Select an option

  • Save bragboy/6838a47703d585940f9d to your computer and use it in GitHub Desktop.

Select an option

Save bragboy/6838a47703d585940f9d to your computer and use it in GitHub Desktop.
bool is_prime(int x)
{
if(x <= 1)
return false;
int s = (int) sqrt(x);
for(int i = 2; i <= s; i++)
if(x%i == 0)
return false;
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment