Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- go:-
- write('Enter a no: '),read(N),nl,
- write('fibonacci series for: '),write(N),nl,write('elements are: '),
- A is 0,
- B is 1,
- write(A),write(' '),write(B),write(' '),
- fibonacci(N,A,B).
- fibonacci(N,A,B):-
- (
- N<2, write('complete');
- C is A+B,
- write(C),write(' '),
- D is B,
- E is C,
- N1 is N-1,
- fibonacci(N1,D,E)
- ).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement