Home > front end >  Js popup calculator
Js popup calculator

Time:12-04

 



<meta charset="utf-8"/& gt;


<body>
Var num=prompt (" please enter the number ");
Var num1=parseInt (num);
Document. The write (num1);
Var ys=prompt (" please input operator/, *, -, + ");
Document. The write (ys);
Var num=prompt (" please enter the number ");
Var num2=parseInt (num);
Document. The write (num2);
Document. The write ("=");
Var num3;
{if (ys=="*")
Document. The write (num1 * num2);
}
Else if (ys=="-") {
Document. The write (num1 - num2);
}
Else if (ys=="+") {
Document. The write (num1 + num2);
}
Else if (ys=="/") {
Document. The write (num1/num2);
}
The else {
Alert (" input a wrong sign of operation ")
}

</script>




  • Related