Advertisement
Guest User

Untitled

a guest
Nov 1st, 2014
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 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=2;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. {
  19. printf("(%d,%d)",t,n);
  20. r++;
  21. }
  22. t=n;
  23. }
  24. }
  25. }
  26. printf("%dtimes",r);
  27. system("pause");
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement