diff options
Diffstat (limited to 'test/c/integr.c')
-rw-r--r-- | test/c/integr.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/test/c/integr.c b/test/c/integr.c index abcbd28..25337dc 100644 --- a/test/c/integr.c +++ b/test/c/integr.c @@ -1,3 +1,6 @@ +#include <stdlib.h> +#include <stdio.h> + static double square(double x) { return x * x; @@ -19,5 +22,11 @@ double test(int n) return integr(square, 0.0, 1.0, n); } - - +int main(int argc, char ** argv) +{ + int n; double r; + if (argc >= 2) n = atoi(argv[1]); else n = 10000; + r = test(n); + printf("integr(square, 0.0, 1.0, %d) = %g\n", n, r); + return 0; +} |