提交时间:2024-01-29 15:06:34

运行 ID: 38973

#include<iostream> #include<cmath> using namespace std; bool is_prime(int num) { if (num<=1) return false; for (int i=2;i<=sqrt(num);i++) { if (num%i==0) return false; } return true; } int main() { int num; cin>>num; if (is_prime(num)) cout<<"yes"; else cout<<"no"; return 0; }