WAP
to illustrate Medical diagnosis problem.
domains
disease, sym=symbol
Reply=char
predicates
check_disease(disease)
symptom(sym)
go
clauses
go:-
write("hi"),
check_disease(disease),
write("\n Hello, I think you are
suffering from:", disease).
symptom(sym):-
write("\n Does patient have"
,sym,"? (y/n)"),
readln(Reply),
Reply=y.
check_disease(diarrhoea):-
symptom(vomiting),
symptom(injestion).
check_disease(chickempox):-
symptom(fever),
symptom(rashes).
Output:-
Goal: go
Enter Name: Sita
Does patient has
ingestion?(y/n) n
Does patient has fever? (y/n)
y
Does patient has rashes?
(y/n) y
Does patient has itching?
(y/n) y
Does patient has headache?
(y/n) y
Hello Sita!
I think u are probably
suffering from: chickenpox Yes