POWER OF A NUMBER IN PROLOG Gain Infiniti

POWER OF A NUMBER IN PROLOG



power(1,N,N).
power(X,N,P):- X1 is X-1,power(X1,N,P1),P is N*P1.

 Output 
 power(3,3,P)
P=27

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 

Design By Manish and Ranjan