+ 1

Why am I getting the wrong output?

code:- program :- write((3+4)). :- program. output:- 3+4

6th Jul 2017, 9:21 AM
Prabhakar Dev
Prabhakar Dev - avatar
5 Antworten
0
No the output is right. Try using variable
6th Jul 2017, 9:37 AM
Lucky
Lucky - avatar
0
I have tried using but there is an error see it:- X is 3*4. program :- write(X). :- program. and:- X = 3*4. program :- write(X). :- program. and:- X is 3*4. X = 12. program :- write(X). :- program.
6th Jul 2017, 9:42 AM
Prabhakar Dev
Prabhakar Dev - avatar
0
Sorry what u want for output?
7th Jul 2017, 5:15 PM
Lucky
Lucky - avatar
0
Value of X. In swi-prolog I am getting __18..something. while the value of X is 12
7th Jul 2017, 5:17 PM
Prabhakar Dev
Prabhakar Dev - avatar
0
start:- sum,nl. sum:- write('X= '),read(X), write('Y= '),read(Y), S is X+Y, write('Sum is '),write(S). Is that help?
7th Jul 2017, 5:32 PM
Lucky
Lucky - avatar