diff options
Diffstat (limited to 'Examples/ruby/simple/example.c')
-rw-r--r-- | Examples/ruby/simple/example.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Examples/ruby/simple/example.c b/Examples/ruby/simple/example.c new file mode 100644 index 0000000..1c2af78 --- /dev/null +++ b/Examples/ruby/simple/example.c @@ -0,0 +1,18 @@ +/* File : example.c */ + +/* A global variable */ +double Foo = 3.0; + +/* 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; +} + + |