Advertisement
Guest User

Untitled

a guest
Nov 1st, 2014
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. int main()
  4. {
  5. int x,n,h,t=-1,r=0;
  6. printf("Please input a number:");
  7. scanf("%d",&x);
  8. for(n=3;n<x;n++)
  9. {
  10. for(h=2;h<n;h++)
  11. {
  12. if(n%h==0)
  13. break;
  14. }
  15. if(n==h)
  16. {
  17. if(n-t==2)
  18. {printf("(%d,%d)",t,n);
  19.  
  20. r++;
  21. } t=n;
  22. }
  23.  
  24. }
  25. printf("%dtimes",r);
  26. system("pause");
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement