+ 7
Please tell why console is displaying error ?
https://code.sololearn.com/Wx3BxMEmn7GF/?ref=app Please help with this code !!!
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);
+ 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
+ 9
+ 7
@Arushi Singhania
welcome đđ
+ 6
Thanks for the help !!!!
+ 4
You are missing some + operators.