20 lines
385 B
C
20 lines
385 B
C
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
int t = 1;
|
||
|
int x;
|
||
|
int a;
|
||
|
int main(void) {
|
||
|
printf("entree un nombre : ");
|
||
|
scanf("%d", &x);
|
||
|
for(a = 2 ; a < x ; a++){
|
||
|
t = t && (x % a != 0);
|
||
|
printf("%d\n",t);
|
||
|
}
|
||
|
if(t == 1){
|
||
|
printf("il est un nombre premier.\n");
|
||
|
}
|
||
|
else{
|
||
|
printf("il n est pas un nombre premier.\n");
|
||
|
}
|
||
|
return EXIT_SUCCESS;
|
||
|
}
|