diff options
| author | Tyge Løvset <[email protected]> | 2023-05-24 19:47:16 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2023-05-24 19:47:16 +0200 |
| commit | c3e01470f45f19215fac339302d87b5d73a323e8 (patch) | |
| tree | a573d484fafc4bee8503c4af7eee1b61ab098010 /misc/examples/prime.c | |
| parent | 276b8110033aa275f58ce60d096f220ca050738c (diff) | |
| download | STC-modified-c3e01470f45f19215fac339302d87b5d73a323e8.tar.gz STC-modified-c3e01470f45f19215fac339302d87b5d73a323e8.zip | |
More coro adjustments.
Diffstat (limited to 'misc/examples/prime.c')
| -rw-r--r-- | misc/examples/prime.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/misc/examples/prime.c b/misc/examples/prime.c index 7efa26ff..cb0f8926 100644 --- a/misc/examples/prime.c +++ b/misc/examples/prime.c @@ -32,9 +32,8 @@ int main(void) clock_t t = clock(); cbits primes = sieveOfEratosthenes(n + 1); int np = (int)cbits_count(&primes); - t = t - clock(); + t = clock() - t; - printf("Number of primes: %d, time: %f\n\n", np, (double)t/CLOCKS_PER_SEC); puts("Show all the primes in the range [2, 1000):"); printf("2"); c_forrange (i, 3, 1000, 2) @@ -49,6 +48,7 @@ int main(void) printf("%lld ", *i.ref); if (c_flt_getcount(i) % 10 == 0) puts(""); } + printf("Number of primes: %d, time: %.2f\n\n", np, (double)t/CLOCKS_PER_SEC); cbits_drop(&primes); } |
