Skip to content

Instantly share code, notes, and snippets.

@joffilyfe
Created January 18, 2015 17:56
Show Gist options
  • Save joffilyfe/6bb2fdc227ff42e7857d to your computer and use it in GitHub Desktop.
Save joffilyfe/6bb2fdc227ff42e7857d to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main(void) {
int num = 0, prime = 0, rep = 0;
int i, j;
scanf("%d", &rep);
for (j=0; j < rep; j++) {
scanf("%d", &num);
prime = 0;
for (i=2; i < num; i++) {
if ( (num % i ) == 0 ) {
prime++;
}
}
if (prime > 0)
printf("%d nao eh primo\n", num);
else
printf("%d eh primo\n", num);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment