文章
61
粉丝
137
获赞
18
访问
38.4k
#include<bits/stdc++.h>
using namespace std;
bool primenumberjudge(int n);
int main(){
int n, m;
int cnt;
while(cin >> n >> m){
cnt = 0;
if(n > m){
int tmp = n;
n = m;
m = tmp;
}
for(int i = n; i <= m; i++)
if(primenumberjudge(i))
cnt++;
cout << cnt << endl;
}
return 0;
}
bool primenumberjudge(int n){
if(n == 1 || n == 0)
return false;
for(int i = 2; i < n; i++){
if(n % i == 0)
return false;
}
return true;
}
登录后发布评论
暂无评论,来抢沙发