Saturday, September 28, 2019

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


Formula for Centigrade (C) temperatures to Fahrenheit (F) -
F = C * 9 / 5 + 32
Rule
Centigrade to Fahrenheit (c_to_f)F is C * 9 / 5 + 32

Program-
c_to_f(C,F) :-F is C * 9 / 5 + 32.
% here freezing point is less than 32 Fahrenheit
freezing (F) :-F =< 32.

Goal to find Fahrenheit temperature and freezing point
Output-