Skip to main content

Posts

Showing posts with the label Artificial Intelligence

What is Horn Clause

Horn Clause: 1) in Mathematical logic and logic programming, a horn clause is a logical formula of a perticuler rule. 2) a horn clause is a clause with at most one positive literal in Disjunction of literals. 3) Horn clause three type : i) definite clause : exactly one positive literal  ii) fact : no negative literal iii) Goal clause : no positive literal

Write a prolog program to factorial of number

Write a prolog program to factorial of number. Code : factorial(0,1). factorial(N,F) :-     N>0,    N1 is N-1,    factorial(N1,F1),    F is N * F1. factorial(0,F,F). Output :  

Write a prolog program which sum of two digit

Q) Write a prolog program which sum of two digit Code : sum(X,Y):- S is X+Y, write(S). Output :