Google Search

Saturday, October 24, 2015

PROLOG Code for Fibonacci Numbers

fibo(1,0).
fibo(2,1).
fibo(N,F):-N>1,N1 is N-1, fibo(N1,F1), N2 is N-2, fibo(N2,F2), F is F1+F2.

No comments:

Post a Comment