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 Answer
+ 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") ;