title: Prolog. How to output solution like Yes or No
body: <p>I tried to solve the problem of a point belongs to the area. As a result, I need to get an answer: if a point belongs to the area or not.
  Coordinates of the point entered by the user from the keyboard. When I try to transfer the coordinates of the point directly in a rule: <code>belongsTo (1,1).</code> I get the desired result (yes or no), but when I enter the coordinates with the keyboard </p>
  
  <pre><code>write ("Input X:"), readreal (X),
  write ("Input Y:"), readreal (Y),
  belongsTo (X, Y).
  </code></pre>
  
  <p>Then the answer will be 'no solutions' or just '2 solutions' (X = 0, Y = 0, X = 0, Y = 0, if you pass the point (0,0))</p>
  
  <p>Here's the code completely:</p>
  
  <pre><code>PREDICATES
      square(real,real)
      semicircle(real,real)
      belongsTo(real,real)
  CLAUSES
      square(X,Y):-
          X&gt;=-1,X&lt;=0,
          Y&gt;=-1,Y&lt;=0.
  
      semicircle(X,Y):-
          X&gt;=0,Y&gt;=0,
          X*X+Y*Y&lt;=1.
  
      belongsTo(X,Y):-
          square(X,Y);
          semicircle(X,Y),!.
  GOAL
      write("Input X: "), readreal(X),
      write("Input Y: "), readreal(Y),
      belongsTo(X,Y).
  </code></pre>
  
  <p>As a result I need to get a solution like YES(if the point belongs to the area) or NO.</p>