# ARTIFICIAL

INTELLIGENCE

LAB FILE

AMITY SCHOOL OF ENGINEERING & TECHNOLOGY

SUBMITTED TO: BY:
MS. RUPALI ROHANKAR KAPIL DEPT. OF CSE 478 ASET

SUBMITTED
ANSH ROLL NO.: SECTION: 7CS-2 SEMESTER: VII

10. Divide Find GCD & LCM Find HCF Print a string N times To find Factorial of a no. 4. 8. Print next number of fibonacii series Print table of a number Disease problem To find simple interest Logic Problem Date Remarks .INDEX S.No . 2. Subtract. 7. 9. 1. Multiply. 6. 5. 3. Experiment Show Arithmetic Operations – Add.

Subtract. Multiply.A).B):C=A+B. D=A-B. Output: . clauses num(A. E=A*B. F=A/B. write("Sum: ".D). write("\nProduct: ".F). write("\n"). write("\nDifference: ".C). write("\nDivision: ".E). Divide domains A=integer predicates num(A.EXPERIMENT 1 AIM: Show Arithmetic Operations – Add.

0.num) lcm(num.X2.result) gcd(num. gcd(X1.write(Y).X3.X1.Y):X1<X2. gcd(X1.Y=X1*X2/Y1.X2):lcm(X1. Output: .X2):gcd(X1. gcd(X2.X2.Y).Y):gcd(X1.EXPERIMENT 2 AIM: Find GCD & LCM domains num.num.Y):Y=X1. gcd(X1.nl.gcd(X2.X2. gcd(X1.result=integer predicates lcm(num. lcm(X1.Y1).num) gcd(num.Y).X2.X2.X2.Y). gcd(X1.Y):X3=X1 mod X2.Y):X1=X2.write(Y).Y).Y=X2.result) clauses lcm(X1.nl.X2.num.

HCF):.P). Output: .A<B. hcf(A.A=B.HCF):.HCF):.A>B. clauses hcf(A.HCF).NA=A-B.NB.hcf(NA.NB=B-A.P.B.B.EXPERIMENT 3 AIM: Find HCF domains P=integer predicates hcf(P.HCF=A.B.B. hcf(A.hcf(A.HCF).

times(P1).EXPERIMENT 4 AIM: Print a string N times domains P=integer predicates times(P). Output: . write("Hello \n"). times(P):P1=P-1. clauses times(0).

1). predicates fact(A.Y):X1=X-1.Y1). fact(X. Output: .EXPERIMENT 5 AIM: To find Factorial of a no.A). fact(X1. clauses fact(1. domains A=integer. Y=X*Y1.

1).1). N2=N-2.F):N>1. F=F1+F2.F2). fib(1.A). Output: . N1=N-1. fib(N.F1). fib(N2.EXPERIMENT 6 AIM: Print next number of fibonacii series domains A=integer. fib(N1. clauses fib(0. predicates fib(A.

A).E).D).B):D=B-1. print(A.10).EXPERIMENT 7 AIM: Print table of a number Domains A=integer Predicates print(A.C." = ". table(A). E=A*C."*". print(A.0):A=A. write("\n"). print(A. write(A. Output: . Clauses table(A):print(A. C=10-D.

symptom(Patient.name=symbol predicates hypothesis(name.fever). symptom(Patient. symptom(Patient. symptom(Patient. Output: .measles):clearwindow.runny_nose).disease) symptom(name. symptom(Patient.rash).conjunctivities).cough).rash).headache). symptom(Patient.symptom(Patient.EXPERIMENT 8 AIM: Disease problem domains disease.indication) clauses symptom(charlie. hypothesis(Patient. symptom(charlie.headache).german_measles):. symptom(Patient. symptom(charlie. symptom(Patient.runny_nose). hypothesis(Patient.rash).fever).indication.runny_nose). symptom(charlie.fever).

D.B.EXPERIMENT 9 AIM: To find simple interest domains n=integer. predicates si(n. Output: .n).”\n”).n. write(“Simple Interest=”.C):D=(A*B*C)/100. clauses si(A.

Father(P).P). Female(priyanka).P). "priyanka"). Male(P).WifeOf(Y. "jawaharlal"). Clauses Person(X) if Male(X) . Daughter(P. Age(X.P). Age(symbol. "indira"). Father(X) if Father(X.1950). Parent(P.P).integer).P).A) if Person(X) .P).EXPERIMENT 10 AIM: Logic Problem Domains P=Symbol. Father("feroz" . WifeOf("indira" .P).P).P). "rajiv"). Born("sanjay". Predicates Born(P. Female(X):. "rahul"). Father(P. Uncle(P. Male(rahul) WifeOf("menka" .P).P).Y). Son(P. Aunt(P. "rajiv"). Elder_Brother(P. Father("rajiv" . GrandMother(P. WifeOf("sanjay" . "sanjay"). Sister(P. Constants Now=2008. Father("jawaharlal" . Father("feroz" .P). Father("rajiv" . "feroz"). WifeOf(P.1999). Mother(P.P). Female(X). Born(X. Father("motilal" . Child(P.integer). "sanjay"). GrandFather(P.X).P).P). Female(P). Brother(P. ._). Born("rajiv". Person(symbol). HusbandOf(P.

Output: .Y) if Sister(X.WifeOf(X.Y) :.Father(Z. Mother(X. Male(X).X) .Y) :.Father(X. Uncle(Z.Y) . Parent(Z.Parent(X.Z) . Father(Z. Female(X).Father(Z. Aunt(X.Father(Z.Child(X.Y). Son(X. Parent(X. Female(X). not(X=Y). Grandmother(X.Parent(X. Parent(Z.Z).B) if eelder_brother.Y). Aunt(X. Female(X) .Y) :.WifeOf(X.Z).Y) :. Parent(Z.Elder_Brother(A. Brother(X.Y).X).X) .Y) :.Mother(X.Y). not(X=Y).Y).Y) .Y) :. Sister(X.Y) .Z) .Z). Male(X) . Grandfather(X.Y) .Y). Child(X.Y) :. Father(Z.Y) :. Daughter(X.Y) :.Y) :.Parent(Y.Y).Child(X. Male(X).