Explorar o código

Merge branch 'exo1'

DricomDragon %!s(int64=5) %!d(string=hai) anos
pai
achega
573d661c54
Modificáronse 1 ficheiros con 10 adicións e 0 borrados
  1. 10 0
      mypower.hs

+ 10 - 0
mypower.hs

@@ -0,0 +1,10 @@
+e1 x n = case n of
+	0 -> 1
+	_ -> x * e1 x (n - 1)
+
+e2 x n =
+	if n == 0
+		then 1
+		else if even n
+			then e2 (x * x) (div n 2)
+			else x * e2 (x * x) (div n 2)