Engineering Lab Files
B-tech. Engineering Lab Practicals Files of all subjects
Pages
Home
7 Semester
Print next number of Fibonacci series - Artificial Intelligence Lab file
AIM
: Print next number of Fibonacci series
domains
A=integer.
predicates
fib(A,A).
clauses
fib(0,1).
fib(1,1).
fib(N,F):-
N>1,
N1=N-1,
N2=N-2,
fib(N1,F1),
fib(N2,F2),
F=F1+F2.
Output:
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment