Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int findprime(int x)
- {
- int check=1;
- for(int i=3;i<sqrt(x)+1;i+=2)
- if(x%i==0)
- {
- check=0;
- break;
- }
- return check;
- }
- int main()
- {
- int a,b;
- while(cin>>a>>b)
- {
- int count=0,A[5]={2,3,5,7,11};
- for(int i=a;i<=b;++i)
- if(!(!(i%2)||!(i%3)||!(i%5)||!(i%7)||!(i%11))&&i!=1)
- count+=findprime(i);
- for(int i=0;i<5;++i)
- if(a<=A[i]&&A[i]<=b)
- ++count;
- cout<<count<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement