Power function in prolog
Posted
by NHans
on Stack Overflow
See other posts from Stack Overflow
or by NHans
Published on 2010-04-17T15:47:22Z
Indexed on
2010/04/17
15:53 UTC
Read the original article
Hit count: 303
Exactly what's the prolog definition for power function. I wrote this code and it give some errors I wanna know exact code for the power function.
pow(X,0,1).
pow(X,Y,Z):-Y1=Y-1,pow(X,Y1,Z1),Z1=Z*X.
Anything wrong with this code?
© Stack Overflow or respective owner