fork download
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int m,n,t,j,i;
  6. cout<<"enter your limit";
  7. cin>>t;
  8. for(i=0;i<t;i++)
  9. {
  10. cout<<"enter the value of m ,n"<<endl;
  11. cin>>m>>n;
  12. for(i=m;i<n;i++)
  13. {
  14. for(int j=2;j<i;j++)
  15. {
  16. if (i%j==0)
  17. break;
  18. else if (i==j+1)
  19. cout<<i<<" ";
  20.  
  21. }
  22. }
  23. }
  24. return 0;
  25. }
Success #stdin #stdout 0s 3344KB
stdin
2
4 34
81 624
stdout
enter your limitenter the value of m ,n
5 7 11 13 17 19 23 29 31