summaryrefslogblamecommitdiff
path: root/examples/gcd_nd.c
blob: 260af41df6ca6e642da5a443e30ebfae889330b8 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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);