#79为什吗只有86分
#include <bits/stdc++.h>
using namespace std;
bool ss(int x) {
if (x == 1 || x == 2) {
return false;
}
for (int i = 2; i < x; i++)
if (x % i == 0)
return false;
return true;
}
int main() {
freopen("prime.in", "r", stdin);
freopen("prime.out", "w", stdout);
int n;
cin >> n;
if (ss(n))
cout << n << " is a prime number.";
else
cout << n << " is not a prime number.";
return 0;
}
共 1 条回复
李老师