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.

12th Jul 2020, 11:17 AM
GĂŒlefƟan
GĂŒlefƟan - avatar
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") ;
12th Jul 2020, 11:27 AM
Jayakrishna 🇼🇳