Skip to main content

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

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. 

Comments