1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
#include<stdio.h> #include<math.h> int main() { int i,j, num, c =0; long int a,b; scanf("%d",&num); while(num--) { scanf("%d%d", &a,&b); if(a==1)a++; for(i=a;i<=b;i++) { c=0; for(j=2;j<=sqrt(i);j++) { if(i%j==0) c = c+1; } if(c==0) printf("%ld\n",i); } } return 0; }