C-study/06/3/isprime.c

17 lines
217 B
C

#include<stdio.h>
int isprime(int n){
int i;
for(i=2;i<=n/2;i++){
if(n%i==0) return 0;
}
return 1;
}
int main(){
int n;
scanf("%d", &n);
printf("%d", isprime(n));
return 0;
}