fork download
  1. #include<iostream>
  2. using namespace std;
  3. void primeno(int x,int y)
  4. {
  5. for(int i=x;i<=y;i++)
  6. {
  7. int c=0;
  8. for(int j=2;j<i;j++)
  9. {
  10. if(i%j==0)
  11. {
  12. break;
  13. }
  14. else
  15. {
  16. c++;
  17. }
  18. }
  19. if(c==(i-2))
  20. {
  21. cout<<i<<"\n";
  22. }
  23. }
  24. };
  25. int main()
  26. {
  27. int n;
  28. cin>>n;
  29. for(int i=0;i<n;i++)
  30. {
  31. int a,b;
  32. cin>>a>>b;
  33. primeno(a,b);
  34. cout<<"\n";
  35. }
  36. return 0;
  37. }
  38.  
Success #stdin #stdout 0s 4420KB
stdin
Standard input is empty
stdout