I am doing a prolog practice which is taken from this.
What I want to do now is to change the input and output way of the program.
I need to execute the program by typing this in the console:
goldbach(100, L).
just for example, and I need to press [;] to show next result when previous one is printed on the screen.
L = [3, 97];
L = [11, 89];
L = ....
However, what I want to make is like below:
Input a number:100.
L = [3, 97].
L = [11, 89].
.....
That is the program will print "Input a number:" first and read your input, then automatically print out all possible result.
I have read sections about read() and write, but I get fail when I add these:
read_gold :-
write('Input a number:'),
read(X),
write(goldbach(X, L)).
How can I fix my code to make the program to achieve the input and output that I want? Thanks for answering.