๐Ÿค–
B.TECH II YEAR โ€ข II SEMESTER โ€ข R22

Skill Development Course - Lab Manual

PROLOG / LISP / PySWIP โ€ข Program 2 Solution

๐Ÿ“˜ R22 Regulation ๐ŸŽ“ II Year ๐Ÿ“š II Semester ๐Ÿค– Skill Development Course ๐Ÿงช Lab Program 2
Aim

Write predicates one converts centigrade temperatures to Fahrenheit, the other checks if a temperature is below freezing.

โ† All Programs

๐Ÿ’ป Solution

week2.pl
% Production rules:

c_to_f
f is c * 9 / 5 + 32
freezing f < = 32

% Rules:

c_to_f(C,F) :-
	F is C * 9 / 5 + 32.

freezing(F) :-
	F =< 32.

๐Ÿ“ค Output

w2.txt
% Queries :

?- c_to_f(100,X).
X = 212
Yes
?- freezing(15).
Yes
?- freezing(45).
No
โ† Program 1 Program 3 โ†’
โ† Back to Skill Development Course Lab Programs ๐Ÿ“š All Lab Manuals