VILL- DEBANDI, AMTA, HOWRAH PIN-711410 Phone-9836357266
3. Write a prolog program to calculate the factorial of a given number.
fact(0,1).
fact(N,F):-( N>0, N1 is N-1, fact(N1,F1), F is N*F1).
OUTPUT:
fact(5,N).
N = 120
Next101001,000 Stop
No comments:
Post a Comment