diff options
| author | tylov <[email protected]> | 2023-07-24 08:30:30 +0200 |
|---|---|---|
| committer | tylov <[email protected]> | 2023-07-24 08:30:30 +0200 |
| commit | d9464e7ddfa70860ca09d373d01dc1a6f7730271 (patch) | |
| tree | d330424ab73e8ca528dce312f3bf15afa8ac2ede /misc/examples/bitsets | |
| parent | e4c169a66c3d55a4d0d3407f47102e54d289a3fb (diff) | |
| parent | 177418232a2d8a8b0df1667d3e4bd15dc37db59f (diff) | |
| download | STC-modified-d9464e7ddfa70860ca09d373d01dc1a6f7730271.tar.gz STC-modified-d9464e7ddfa70860ca09d373d01dc1a6f7730271.zip | |
Merge branch 'master' into dev43
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); } |
