#include <iostream> using namespace std; int main() { // write your code here...... int n; cin >> n; for(int i=2;i*i<=n;i++){ if(n%i==0){ cout << "不是质数" << endl; return 0; } } cout << "是质数" << endl; }
#include <iostream> using namespace std; int main() { // write your code here...... int n; cin >> n; for(int i=2;i*i<=n;i++){ if(n%i==0){ cout << "不是质数" << endl; return 0; } } cout << "是质数" << endl; }