To find the factorial of given number in PROLOG. Earthcare Foundation NGO 22:15 Prolog No comments fact(X,Y):-X is 0,Y is 1; X>0,N is X-1, fact(N,G),Y is X*G. Output 1 ?- fact(3,X). X = 6 . 2 ?- fact(22,X). X = 1124000727777607680000 Share This: Facebook Twitter Google+ Stumble Digg Email ThisBlogThis!Share to XShare to Facebook
0 comments:
Post a Comment