fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int a,b;
  6. while(cin>>a>>b)
  7. {
  8. int count=0;
  9. for(int i=a;i<=b;i++)
  10. {
  11. int c=0;
  12. for(int j=1;j<=i;j++)
  13. {
  14. if(i%j==0)
  15. c++;
  16. }
  17. if(c==2)
  18. count++;
  19. }
  20. cout<<count<<"\n";
  21. }
  22. return 0;
  23. }
Success #stdin #stdout 0s 5496KB
stdin
4 12

70 110

5 150
stdout
3
10
33