Advertisement
Guest User

square

a guest
Sep 16th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 0.20 KB | None | 0 0
  1. square(A, M, N, C) :- N > 1, M >= 1, write(C),  N1 is N-1, square(A, M, N1, C).
  2. square(A, M, 1, C) :- write(C), nl, M1 is M-1, square(A, M1, A, C).
  3. square(_, 0, _, _).
  4.  
  5. square(N, C) :- square(N, N, N, C).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement