判断素数

来源:互联网 发布:视频抠像软件 编辑:程序博客网 时间:2024/05/25 05:35
#include <stdio.h>
#include <stdlib.h>
#include <math.h> 
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int isprime(int n){

int m=2;
if(n<=1)
return 0;
for(;m*m<=n;++m)
if(n%m==0)
return 0;
return 1; 
}
int main(int argc, char *argv[]) {
int n;
printf("%d",isprime(n));



return 0;
}
0 0
原创粉丝点击