Skrypt |
<script type="text/javascript">
var x = prompt("Podaj pierwszą liczbę","");
var y = prompt("Podaj drugą liczbę","");
var dzialanie = prompt("wybierz działanie\nd - dodawanie\no - odejmowanie\nm - mnożenie\ndd - dzielenie","");
if(dzialanie == "d"){
var tmp = parseInt(x)+parseInt(y);
document.write (x + " + " + y + " = " + tmp);
}
if(dzialanie == "o"){
var tmp = parseInt(x)-parseInt(y);
document.write (x + " - " + y + " = " + tmp);
}
if(dzialanie == "m"){
var tmp = parseInt(x)*parseInt(y);
document.write (x + " * " + y + " = " + tmp);
}
if(dzialanie == "dd"){
var tmp = parseInt(x)/parseInt(y);
document.write (x + " / " + y + " = " + tmp);
}
</script>
|