Logo 
Search:

Artificial Intelligence Articles

Submit Article
Home » Articles » Artificial Intelligence » ProLogRSS Feeds

Prolog program to generate a fibonacci series of N elements

Posted By: Milind Mishra     Category: Artificial Intelligence     Views: 12817

Prolog program to generate a fibonacci series of N elements.

Code for Prolog program to generate a fibonacci series of N elements in Artificial Intelligence

domains
    x = integer
    
predicates
    fibonacci(x)
    
clauses
    fibonacci(1).
        
    fibonacci(N) :-
        N1 = N - 1,
        N1 >= 0,!,
        fibonacci(N1),
        write(F1," ,"),
        F = F1 + N.
  
Share: 



Milind Mishra
Milind Mishra author of Prolog program to generate a fibonacci series of N elements is from India.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!