#include <iostream>
#include <math.h>
using namespace std;
/*判断素数*/
int isprime(int number)
{
if(number<2){
return 0;
}else{
for(int i=2;i<=sqrt(number);i++){
if(number % i == 0){
return 0;
}
}
return 1;
}
}
int main()
{
int number = 0;
cin >> number;
if(isprime(number)){
cout << "the number is prime"<< endl;
}else{
cout << "the number is not prime" << endl;
}
return 0;
}
标签:判断,int,基础,number,素数,isprime,include
From: https://www.cnblogs.com/tccjx/p/17652602.html