diff options
Diffstat (limited to 'Examples/guile/simple/example.c')
-rw-r--r-- | Examples/guile/simple/example.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/Examples/guile/simple/example.c b/Examples/guile/simple/example.c index dcafc4dc4..1c2af789c 100644 --- a/Examples/guile/simple/example.c +++ b/Examples/guile/simple/example.c @@ -1,21 +1,18 @@ -/* Simple example from documentation */ /* File : example.c */ -#include <time.h> +/* A global variable */ +double Foo = 3.0; -double My_variable = 3.0; - -int fact(int n) { - if (n <= 1) return 1; - else return n*fact(n-1); +/* Compute the greatest common divisor of positive integers */ +int gcd(int x, int y) { + int g; + g = y; + while (x > 0) { + g = x; + x = y % x; + y = g; + } + return g; } -int mod(int n, int m) { - return (n % m); -} -char *get_time() { - long ltime; - time(<ime); - return ctime(<ime); -} |