fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int t,j[100],max[100],u,m,v;
  6. char ch;
  7. cout<<"Enter the number of tests "<<endl;
  8. cin>>t;
  9. cout<<"Enter the minimum number followed by \",\" then the maximum number "<<endl;
  10. for(int n=0;n<t;n++)
  11. cin>>j[n]>>max[n];
  12. for(int n=0;n<t;n++)
  13. {
  14. for(int i=j[n];i<=max[n];i++)
  15. {
  16. v=1;
  17. for(u=2;u<i+1;u++)
  18. {
  19. m=i-1;
  20. if(i%u==0)
  21. break;
  22. else v++;
  23. }
  24. if(v==m)
  25. cout<<'\n'<<i;
  26. }
  27. cout<<endl<<endl;
  28. }
  29. return 0;
  30. }
Success #stdin #stdout 0s 3472KB
stdin
2
1 10
3 5
stdout
Enter the number of tests 
Enter the minimum number followed by "," then the maximum number 

2
3
5
7


3
5