Skip to content

Instantly share code, notes, and snippets.

@scottoasis
Created September 4, 2014 14:13
Show Gist options
  • Save scottoasis/4cbc2ddc1375bae409d5 to your computer and use it in GitHub Desktop.
Save scottoasis/4cbc2ddc1375bae409d5 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main () {
int num;
scanf("%d", &num);
if (num <= 0) {
return -1;
}
for (int divisor = 0; divisor <= num / 2; divisor ++) {
if (num % divisor == 0) {
printf("%s\n", "NO");
return 0;
}
}
printf("%s\n", "YES");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment