题解 | #打印乘法表#
判断一个数是不是质数
http://www.nowcoder.com/practice/b8bb5e7703da4a83ac7754c0f3d45a82
using namespace std;
void isprime(int num){
int i;
if (num== 1){
cout << "不是素数";
}
else{
for ( i = 2; i < num; i++){
if (num%i == 0) break;
}
if (i < num){
cout << "不是质数";
}
else cout << "是质数";
}
}
int main() {
// write your code here......
int n;
cin >> n;
isprime(n);
return 0;
}