Advertisement
Guest User

Untitled

a guest
Feb 15th, 2011
1,909
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3.  
  4. int primo (int n) {
  5.  
  6. for(int i=2; i<n; i++) {
  7.  
  8.       if(n==2)
  9.       return 1;
  10.  
  11.          if (n%i==0)
  12.          continue;
  13.          else
  14.          return 1;
  15.          }
  16.          return 0;
  17. }
  18.  
  19. main() {
  20.  
  21. int n;
  22. printf("entre com um valor");
  23. scanf("%d",&n);
  24.  
  25. printf("%d\n",primo(n));
  26.  
  27. system("pause");
  28. return 0;
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement