Skip to main content

Posts

Showing posts from September, 2021

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.  

Write simple fact for the statement using PROLOG

  Write simple fact for the statement using PROLOG . A Prolog program consists of a number of clauses. Each clause is either a  fact  or a  rule . After a Prolog program is loaded (or  consulted ) in a Prolog interpreter, users can submit  goals or queries , and the Prolog intepreter will give results (answers) according to the facts and rules. Facts   A  fact  must start with a predicate (which is an atom) and end with a fullstop. The predicate may be followed by one or more arguments which are enclosed by parentheses. The arguments can be atoms (in this case, these atoms are treated as constants), numbers, variables or lists. Arguments are separated by commas. If we consider the arguments in a fact to be objects, then the  predicate  of the fact describes a property of the objects. In a Prolog program, a presence of a fact indicates a statement that is true. An absence of a fact indicates a statement that is not true. Se...