0
Where did I make a mistake??
<script> var first = prompt("Enter an integer","0"); var second = prompt("Enter another integer","0"); var s = first + second; var d = first - second; var m = first * second; var q = first / second; document.write("Toplama işleminin sonucu " + s + "<br />"); document.write("Çıkarma işleminin sonucu " + d + "<br />"); document.write("Çarpma işleminin sonucu " + m + "<br />"); document.write("Bölme işleminin sonucu " + q + "<br />"); </script> S is not working. Other operations are working correctly, but addition (var s) is not working. Where did I go wrong? I can't see it. Please help me.
1 Respuesta
+ 5
promt accept input in string farmat..
And addition + operator works as cancatination operation for string.. So you need convert string values to numbers..
Ex:
var first= Number(promt("enter")) ;
Or just you can use + as +promt("text") ;