diff options
author | Edwin Groothuis <edwin@FreeBSD.org> | 2009-05-21 07:54:21 +0000 |
---|---|---|
committer | Edwin Groothuis <edwin@FreeBSD.org> | 2009-05-21 07:54:21 +0000 |
commit | b16ac5b53f6b943b7017f01d411721173b4f1b96 (patch) | |
tree | 4f4a683a19a5fb250b588f359f30f135a697f2f7 /prime.c | |
parent | c1dc0a1745ca8959fc4ce61ce026e2a83984c13e (diff) |
Notes
Diffstat (limited to 'prime.c')
-rw-r--r-- | prime.c | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/prime.c b/prime.c deleted file mode 100644 index b0d65424b5e0..000000000000 --- a/prime.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Prime number generator. It prints on stdout the next prime number - * higher than the number specified as argv[1]. - */ - -#include <stdio.h> -#include <math.h> - -main(argc, argv) - -int argc; -char *argv[]; - -{ - double i, j; - int f; - - if (argc < 2) - { - exit(1); - } - - i = atoi(argv[1]); - while (i++) - { - f=1; - for (j=2; j<i; j++) - { - if ((i/j)==floor(i/j)) - { - f=0; - break; - } - } - if (f) - { - printf("%.0f\n", i); - exit(0); - } - } -} |