代码:#include#includeboolfun(intn){inti;for(i=2;i<=sqrt(n);i++){if(n%i==0)returnfalse;}returntrue;}voidmain(){intn;printf("请输入一个数:\n");scanf("%d",&n);if(fun(n))printf("该数是素数:\n");elseprintf("该数不是是素数:\n");}图: