Advertisement
Guest User

Untitled

a guest
Oct 19th, 2017
128
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> /* printf */
  2.  
  3. /* Prototypes implemented in primes1.c */
  4. int is_prime(int n);
  5. void conjecture(int low, int high);
  6.  
  7. void check_primes(int count)
  8. {
  9. int primes = 0; /* number of primes found */
  10. int i; /* loop counter */
  11.  
  12. /* Check all values from 1 to count */
  13. for (i = 1; i <= count; i++)
  14. {
  15. /* If it's prime, count it and print it */
  16. if (is_prime(i))
  17. {
  18. primes++;
  19. printf("#%3i: %3i is prime.\n", primes, i);
  20. }
  21. }
  22. }
  23.  
  24. int main(void)
  25. {
  26. /*check_primes(1000);*/
  27. conjecture(2, 2000);
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement