fork download
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int i,a,count=0,k,j;
  6.  
  7. scanf("%d",&a);// no of test cases
  8.  
  9. int b[a][2];
  10.  
  11. for(i=0;i<a;i++)
  12. {
  13. for(j=0;j<2;j++)
  14. {
  15. scanf("%d",&b[i][j]);
  16. }
  17. }
  18.  
  19. for(k=0;k<a;k++)
  20. {
  21. for(i=b[k][0];i<=b[k][1];i++)
  22. {
  23. for(j=1;j<=b[k][1];j++)
  24. {
  25. if(i%j==0)
  26. {
  27. count++;
  28. }
  29. }
  30.  
  31. if(count==2)
  32. {
  33. printf("%d \n",i);
  34. }
  35. count=0;
  36. }
  37. printf("\n");
  38.  
  39. }
  40.  
  41. return 0;
  42. }
Success #stdin #stdout 0s 2252KB
stdin
4
1 10
2 5
3 5
4 7
stdout
2 
3 
5 
7 

2 
3 
5 

3 
5 

5 
7