fork download
  1. #include<stdio.h>
  2. #include<math.h>
  3. int main()
  4. {
  5. int i,m,n,isPrime=1;
  6. scanf("%d %d",&m,&n);
  7. for(int i=m;i<=n;i++)
  8. {
  9. if(i==1)
  10. {
  11. continue;
  12. }
  13. isPrime=1;
  14. for(int j=2;j<i;j++)
  15. {
  16. if(i%j==0)
  17. {
  18. isPrime==0;
  19. break;
  20. }
  21. }
  22. if(isPrime==1)
  23. {
  24. printf("%d\n",i);
  25. }
  26. }
  27. }
  28.  
  29.  
Success #stdin #stdout 0s 5280KB
stdin
2
10
stdout
2
3
4
5
6
7
8
9
10