Advertisement
shamiul93

ct 3 no.

Mar 30th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. main()
  4.  
  5. {
  6. int n1,n2,i,j,m , prime1=1 , prime2=1 ;
  7.  
  8. printf("enter ranges:");
  9.  
  10. scanf("%d %d",&n1,&n2);
  11.  
  12. for(i=n1;i<=n2;i++)
  13. {
  14. prime1=1 , prime2=1 ;///for not giving this line , I am going to get very little number. so , you have to be careful about these small things next time .
  15.  
  16. for(j=2;j<i;j++)
  17. {
  18. if(i%j==0)
  19. {
  20. prime1=0;
  21. break;
  22. }
  23. }
  24. for(m=2;m<i+2;m++)
  25. {
  26. if((i+2)%m==0)
  27. {
  28. prime2=0;
  29. break;
  30. }
  31. }
  32.  
  33.  
  34. if(prime1==1&&prime2==1&&i+2<n2)
  35. printf("%d %d \n",i,i+2);
  36.  
  37.  
  38. }
  39.  
  40. return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement