ChameL1oN

ЯП2_3

May 31st, 2015
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 0.26 KB | None | 0 0
  1. predicates
  2. nondeterm nod(integer,integer,integer)
  3. clauses
  4. nod(X,X,X).
  5. nod(X,Y,Z) :- X<Y, Y1=Y-X, nod(X,Y1,Z).
  6. nod(X,Y,Z) :- X>Y, X1=X-Y, nod(X1,Y,Z).
  7. goal
  8. write("Chislo X?"), readint(X), write("Chislo Y ?"),readint(Y), nod(X,Y,Z), nl,write("NOD = ",Z),nl, nl.
Advertisement
Add Comment
Please, Sign In to add comment