Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. is_prime(int candidate){
  2.  
  3. int i=0;
  4. for(i=2;i<candidate;i++){
  5. if(candidate%i==0){
  6. return 0;
  7. }
  8. }
  9. return 1;
  10. }
  11. int main(void){
  12. int candidate =2;
  13. int n=0;
  14. while(n<200){
  15. if(is_prime(candidate)){
  16. printf("%5d\n",candidate);
  17. n++;
  18. }
  19. candidate++;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement