diff options
Diffstat (limited to 'misc/examples/bitsets')
| -rw-r--r-- | misc/examples/bitsets/prime.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/misc/examples/bitsets/prime.c b/misc/examples/bitsets/prime.c index 462526a2..8216e332 100644 --- a/misc/examples/bitsets/prime.c +++ b/misc/examples/bitsets/prime.c @@ -31,9 +31,12 @@ int main(void) clock_t t = clock(); cbits primes = sieveOfEratosthenes(n + 1); + llong np = cbits_count(&primes); t = clock() - t; + printf("Number of primes: %lld, time: %f\n\n", np, (float)t / (float)CLOCKS_PER_SEC); + puts("Show all the primes in the range [2, 1000):"); printf("2"); c_forrange (i, 3, 1000, 2) @@ -50,7 +53,6 @@ int main(void) printf("%lld ", *i.ref); if (c_flt_getcount(i) % 10 == 0) puts(""); } - printf("Number of primes: %lld, time: %.2f\n\n", np, (double)t/CLOCKS_PER_SEC); cbits_drop(&primes); } |
