Skip to content

Instantly share code, notes, and snippets.

@Alex4386
Created April 11, 2019 06:06
Show Gist options
  • Save Alex4386/99af8680bf5ae036e0e2ffa463f005ba to your computer and use it in GitHub Desktop.
Save Alex4386/99af8680bf5ae036e0e2ffa463f005ba to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main() {
for (int num = 2; num < 100000000 ; num++) {
bool isPrime = true;
for (int i = 2; i <= (num / 2); i++) {
if (num % i == 0) {
isPrime = false;
break;
}
}
if (isPrime) {
printf("%d is prime!\n", num);
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment