Hello there.! Can anyone help me., I need a simple calculator using html and js., Pls help me | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

Hello there.! Can anyone help me., I need a simple calculator using html and js., Pls help me

It contain four buttons like ➕✖️➖➗ Below the four buttons we need two value box's [Value 1] operator [value 2] equal button [result] If we click the operators the sign of an operator will shown in the place of operator.

23rd Apr 2021, 10:42 AM
venkat veeru
venkat veeru - avatar
3 Answers
0
Tapabrata Banerjee ok bro., If I click a oprater button. The sign of oprater will be shown in between the two input values., Pls tell me that how can I do that
23rd Apr 2021, 10:55 AM
venkat veeru
venkat veeru - avatar
0
showresult(choise){ var n1=parsefloat(document.getElementById('num1').value); var n2=parsefloat(document.getElementById('num2').value); var r; var c=choise; switch(c) { case '1': r=n1+n2; break; case '2': r=n1-n2; break; case '3': r=n1*n2 break; case '4': r=n1/n2; break; case '5': r=n2*100/n1; break; default: break; } document.getElementById('result').innerHTML=r; }
23rd Apr 2021, 10:57 AM
Devil Shark
Devil Shark - avatar
- 2
Thanks but. It's an assignment. So I need to do it as requirements
23rd Apr 2021, 10:48 AM
venkat veeru
venkat veeru - avatar