Skip to content

Commit 6cc402b

Browse files
c252berquist
authored andcommitted
change formatting in euclid alg in nim (#466)
Just going through and fixing the formatting errors in the nim programs. I change the indentation and change temp from a var to a let, since the it didn't need to mutable
1 parent a03e77c commit 6cc402b

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed
Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
proc euclid_mod(in1, in2: int): int =
2-
var
3-
a = abs(in1)
4-
b = abs(in2)
2+
var
3+
a = abs(in1)
4+
b = abs(in2)
55

6-
while b != 0:
7-
var temp: int = b
8-
b = a mod b
9-
a = temp;
6+
while b != 0:
7+
let temp: int = b
8+
b = a mod b
9+
a = temp;
1010

1111
return a
1212

1313
proc euclid_sub(in1, in2: int): int =
14-
var
15-
a = abs(in1)
16-
b = abs(in2)
14+
var
15+
a = abs(in1)
16+
b = abs(in2)
1717

18-
while a != b:
19-
if a > b:
20-
a -= b
21-
else:
22-
b -= a
18+
while a != b:
19+
if a > b:
20+
a -= b
21+
else:
22+
b -= a
2323

2424
return a
2525

26-
echo euclid_sub(32*5,32*3)
27-
echo euclid_mod(64*2,64*7)
26+
echo euclid_sub(64 * 67, 64 * 81)
27+
echo euclid_mod(128 * 12, 128 * 77)

0 commit comments

Comments
 (0)