support up to 6 args, euler
This commit is contained in:
21
examples/euler5.zr
Normal file
21
examples/euler5.zr
Normal file
@@ -0,0 +1,21 @@
|
||||
func print_i64[x : I64] : I64
|
||||
printf("%ld\n", x)
|
||||
|
||||
func gcd[a: I64, b: I64] : I64
|
||||
while b != 0
|
||||
let tmp: I64 = b
|
||||
b = a % b
|
||||
a = tmp
|
||||
return a
|
||||
|
||||
func lcm[a: I64, b: I64] : I64
|
||||
return (a * b) / gcd(a, b)
|
||||
|
||||
func main[] : I64
|
||||
let out: I64 = 1
|
||||
|
||||
let i: I64 = 1
|
||||
while i < 21
|
||||
out = lcm(out, i)
|
||||
i = i + 1
|
||||
print_i64(out)
|
||||
Reference in New Issue
Block a user