Print table of a number - Artificial Intelligence Lab file



AIM: Print table of a number

Domains
A=integer

Predicates
print(A,A).
table(A).

Clauses
      table(A):-
                 print(A,10).
             
      print(A,0):-
                 A=A.
                
      print(A,B):-
                 D=B-1,
                 C=10-D,
                 E=A*C,
                 write(A,"*",C," = ",E),
                 write("\n"),
                 print(A,D).            

Output:


No comments:

Post a Comment