From bcde99fbe99174a094f38fdda70ad69d65a423f4 Mon Sep 17 00:00:00 2001 From: Alex AUVOLAT Date: Wed, 30 Apr 2014 17:19:08 +0200 Subject: Fist commit (WIP) --- examples/gcd_nd.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 examples/gcd_nd.c (limited to 'examples/gcd_nd.c') diff --git a/examples/gcd_nd.c b/examples/gcd_nd.c new file mode 100644 index 0000000..260af41 --- /dev/null +++ b/examples/gcd_nd.c @@ -0,0 +1,15 @@ +a = rand(5,15); +b = rand(3,8); + +if (a < 0) a = -a; +if (b < 0) b = -b; +while (b > 0) { // try changing this to b >= 0 + tmp = b; + b = a % b; + a = tmp; + } +assert (b==0); // should be true +//assert (a>6); // try uncommenting this line +tmp = 0; +print (a); + -- cgit v1.2.3