文章
49
粉丝
90
获赞
90
访问
37.9k
- #include<cmath>
- #include<iostream>
- using namespace std;
-
- bool sushu(int n)
- {
- if (n < 2)
- {
- return false;
- }
- else
- {
- for (int i = 2; i <= sqrt(n); i++)
- {
- if (n % i == 0)
- return false;
- }
- }
- return true;
- }
-
- int main()
- {
- int n;
- while (cin >> n)
- {
- if (sushu(n))
- {
- cout << "yes" << endl;
- }
- else
- {
- cout << "no" << endl;
- }
- }
- return 0;
- }
登录后发布评论
暂无评论,来抢沙发