+ 7

Please tell why console is displaying error ?

https://code.sololearn.com/Wx3BxMEmn7GF/?ref=app Please help with this code !!!

11th Mar 2018, 11:41 AM
Arushi Singhania
Arushi Singhania - avatar
6 Answers
+ 11
just replace your programs two line with this line and then run your code. it will successfully generate output error in your document.write statement please check it below 👍 document.write("Triplets are:"+Triplet +" "+y +" "+z); document.write("Triplets are:"+Triplet+" "+y+" "+z);
11th Mar 2018, 11:46 AM
ASIF BILAKHIYA
ASIF BILAKHIYA - avatar
+ 15
alert ("Please upvote the code if you like it!!!"); var Triplet= prompt("Enter the smallest number of Pythagorean triplet !!!"); if(Triplet % 2 == 1) { var y = (Triplet*Triplet-1)/2 var z = y+1 document.write("Triplets are:"+Triplet+" "+y+" "+z); } if ( Triplet % 2 ==0 ){ var y = (Triplet/2)*(Triplet/2)-1 var z = y+2 document.write("Triplets are:"+Triplet+" "+y+" "+z);} //+ operator to concatinate Strings
11th Mar 2018, 11:47 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
11th Mar 2018, 11:51 AM
abhijeet
abhijeet - avatar
+ 7
@Arushi Singhania welcome 😊😊
11th Mar 2018, 11:55 AM
ASIF BILAKHIYA
ASIF BILAKHIYA - avatar
+ 6
Thanks for the help !!!!
11th Mar 2018, 11:51 AM
Arushi Singhania
Arushi Singhania - avatar
+ 4
You are missing some + operators.
11th Mar 2018, 11:48 AM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar